diff options
author | Shoaib Meenai <smeenai@fb.com> | 2024-02-20 09:42:18 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-20 09:42:18 -0800 |
commit | d2942a86d7b8fc4cba4f73294efb53a3e47dc751 (patch) | |
tree | 3cccb936e01b61a892610f56fe3f6de5e0c50013 /llvm/lib/Transforms/IPO/MergeFunctions.cpp | |
parent | 4c6043de0b837d23699424d875057d00956d80ac (diff) | |
download | llvm-d2942a86d7b8fc4cba4f73294efb53a3e47dc751.zip llvm-d2942a86d7b8fc4cba4f73294efb53a3e47dc751.tar.gz llvm-d2942a86d7b8fc4cba4f73294efb53a3e47dc751.tar.bz2 |
[MergeFunctions] Fix thunks for non-instruction debug info (#82080)
When MergeFunctions creates new thunk functions, it needs to copy over
the debug info format kind from the original function, otherwise we'll
mix debug info formats and run into assertions. This was exposed by a
downstream change that runs MergeFunctions before inlining, which caused
assertions when inlining attempted to inline thunks created by merging,
and the added test covers both scenarios where merging creates thunks.
Diffstat (limited to 'llvm/lib/Transforms/IPO/MergeFunctions.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/MergeFunctions.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp index 1428a09..591be6b 100644 --- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp +++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp @@ -747,6 +747,7 @@ void MergeFunctions::writeThunk(Function *F, Function *G) { NewG = Function::Create(G->getFunctionType(), G->getLinkage(), G->getAddressSpace(), "", G->getParent()); NewG->setComdat(G->getComdat()); + NewG->IsNewDbgInfoFormat = G->IsNewDbgInfoFormat; BB = BasicBlock::Create(F->getContext(), "", NewG); } @@ -874,6 +875,7 @@ void MergeFunctions::mergeTwoFunctions(Function *F, Function *G) { F->getAddressSpace(), "", F->getParent()); NewF->copyAttributesFrom(F); NewF->takeName(F); + NewF->IsNewDbgInfoFormat = F->IsNewDbgInfoFormat; // Ensure CFI type metadata is propagated to the new function. copyMetadataIfPresent(F, NewF, "type"); copyMetadataIfPresent(F, NewF, "kcfi_type"); |