diff options
author | Artur Pilipenko <apilipenko@azulsystems.com> | 2016-06-24 15:10:29 +0000 |
---|---|---|
committer | Artur Pilipenko <apilipenko@azulsystems.com> | 2016-06-24 15:10:29 +0000 |
commit | 140d9e6906892dc07774e1598a17c8836f2b9381 (patch) | |
tree | f4d0e487058bf8ee0dbef8fee16428a8236da99d /lib/Linker | |
parent | 2630656dc9b27283cfb72b89d9f25e4768d6bd74 (diff) |
Remangle intrinsics names when types are renamed
This is a resubmittion of previously reverted rL273568.
This is a fix for the problem mentioned in "LTO and intrinsics mangling" llvm-dev mail thread:
http://lists.llvm.org/pipermail/llvm-dev/2016-April/098387.html
Reviewers: mehdi_amini, reames
Differential Revision: http://reviews.llvm.org/D19373
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273686 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Linker')
-rw-r--r-- | lib/Linker/IRMover.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Linker/IRMover.cpp b/lib/Linker/IRMover.cpp index 7d09b7be868..c82fc8b3dff 100644 --- a/lib/Linker/IRMover.cpp +++ b/lib/Linker/IRMover.cpp @@ -16,6 +16,7 @@ #include "llvm/IR/DebugInfo.h" #include "llvm/IR/DiagnosticPrinter.h" #include "llvm/IR/GVMaterializer.h" +#include "llvm/IR/Intrinsics.h" #include "llvm/IR/TypeFinder.h" #include "llvm/Support/Error.h" #include "llvm/Transforms/Utils/Cloning.h" @@ -901,6 +902,14 @@ Expected<Constant *> IRLinker::linkGlobalValueProto(GlobalValue *SGV, if (ShouldLink || !ForAlias) forceRenaming(NewGV, SGV->getName()); } + + // Overloaded intrinsics have overloaded types names as part of their + // names. If we renamed overloaded types we should rename the intrinsic + // as well. + if (Function *F = dyn_cast<Function>(NewGV)) + if (auto Remangled = Intrinsic::remangleIntrinsicFunction(F)) + NewGV = Remangled.getValue(); + if (ShouldLink || ForAlias) { if (const Comdat *SC = SGV->getComdat()) { if (auto *GO = dyn_cast<GlobalObject>(NewGV)) { |