diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2019-04-19 01:48:36 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2019-04-19 01:48:36 +0000 |
commit | b96d9b3419161694e91a106354253f8ab3525c87 (patch) | |
tree | dbf09b43f9f1d7e6510d435cbbc295702ce1dabb /llvm/lib/Transforms/IPO/MergeFunctions.cpp | |
parent | 14ada6d1ad8def80e7a8937dc47a959e026477c4 (diff) | |
download | bcm5719-llvm-b96d9b3419161694e91a106354253f8ab3525c87.tar.gz bcm5719-llvm-b96d9b3419161694e91a106354253f8ab3525c87.zip |
MergeFunc: preserve COMDAT information when creating a thunk
We would previously drop the COMDAT on the thunk we generated when replacing a
function body with the forwarding thunk. This would result in a function that
may have been multiply emitted and multiply merged to be emitted with the same
name without the COMDAT. This is a hard error with PE/COFF where the COMDAT is
used for the deduplication of Value Witness functions for Swift.
llvm-svn: 358728
Diffstat (limited to 'llvm/lib/Transforms/IPO/MergeFunctions.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/MergeFunctions.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp index 1ca4ebecd08..d0c16138f9e 100644 --- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp +++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp @@ -703,6 +703,7 @@ void MergeFunctions::writeThunk(Function *F, Function *G) { } else { NewG = Function::Create(G->getFunctionType(), G->getLinkage(), G->getAddressSpace(), "", G->getParent()); + NewG->setComdat(G->getComdat()); BB = BasicBlock::Create(F->getContext(), "", NewG); } |