diff options
author | Mehdi Amini <mehdi.amini@apple.com> | 2016-09-03 21:12:33 +0000 |
---|---|---|
committer | Mehdi Amini <mehdi.amini@apple.com> | 2016-09-03 21:12:33 +0000 |
commit | 1c224c03d33d5d1a472b2858ca6a16f73ed4a941 (patch) | |
tree | b01b5ed3be1f62029be2f18bfa24b3201f3cb84c /lib/Linker | |
parent | 9101366306e5003b9dc36e55c5a7e8c4e210cca9 (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280599 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Linker')
-rw-r--r-- | lib/Linker/IRMover.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Linker/IRMover.cpp b/lib/Linker/IRMover.cpp index 6def096ccd7..c02abd7e3ac 100644 --- a/lib/Linker/IRMover.cpp +++ b/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( |