summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2016-09-03 21:12:33 +0000
committerMehdi Amini <mehdi.amini@apple.com>2016-09-03 21:12:33 +0000
commitebb34348500aa8dd93125e71e36da779339d89a1 (patch)
tree1b876c337d54ea9cafc65b72315d28d5ed188a78 /llvm/lib
parent3606d2346cccfb4f6dbb5f7903eeb11ebc151c25 (diff)
downloadbcm5719-llvm-ebb34348500aa8dd93125e71e36da779339d89a1.tar.gz
bcm5719-llvm-ebb34348500aa8dd93125e71e36da779339d89a1.zip
Fix ThinLTO crash with debug info
Because the recent change about ODR type uniquing in the context, we can reach types defined in another module during IR linking. This triggered some assertions in case we IR link without starting from an empty module. To alleviate that, we can self-map metadata defined in the destination module so that they won't be visited. Differential Revision: https://reviews.llvm.org/D23841 llvm-svn: 280599
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Linker/IRMover.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp
index 6def096ccd7..c02abd7e3ac 100644
--- a/llvm/lib/Linker/IRMover.cpp
+++ b/llvm/lib/Linker/IRMover.cpp
@@ -1342,6 +1342,12 @@ IRMover::IRMover(Module &M) : Composite(M) {
else
IdentifiedStructTypes.addNonOpaque(Ty);
}
+ // Self-map metadatas in the destination module. This is needed when
+ // DebugTypeODRUniquing is enabled on the LLVMContext, since metadata in the
+ // destination module may be reached from the source module.
+ for (auto *MD : StructTypes.getVisitedMetadata()) {
+ SharedMDs[MD].reset(const_cast<MDNode *>(MD));
+ }
}
Error IRMover::move(
OpenPOWER on IntegriCloud