diff options
author | Teresa Johnson <tejohnson@google.com> | 2015-12-30 19:32:24 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2015-12-30 19:32:24 +0000 |
commit | cc428573a259b324d672c42fa6c466120aeef205 (patch) | |
tree | 9760654a0eed138adada1b144654419d9357d77d /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | 3e0e6e75d7fa9e199f00285a9c056f7f9e1e75f1 (diff) | |
download | llvm-cc428573a259b324d672c42fa6c466120aeef205.zip llvm-cc428573a259b324d672c42fa6c466120aeef205.tar.gz llvm-cc428573a259b324d672c42fa6c466120aeef205.tar.bz2 |
Ensure MDNode used as key in metadata linking map cannot be RAUWed
As suggested in review for r255909, add a way to ensure that temporary
MD used as keys in the MetadataToID map during ThinLTO importing are not
RAUWed.
Add support for marking an MDNode as not replaceable. Clear the new
CanReplace flag when adding a temporary MD node to the MetadataToID map
and clear it when destroying the map.
llvm-svn: 256648
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 824a371..c7606fd 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -3085,6 +3085,11 @@ void BitcodeReader::saveMetadataList( assert(MetadataToIDs[MD] == ID && "Inconsistent metadata value id"); continue; } + if (N && N->isTemporary()) + // Ensure that we assert if someone tries to RAUW this temporary + // metadata while it is the key of a map. The flag will be set back + // to true when the saved metadata list is destroyed. + N->setCanReplace(false); MetadataToIDs[MD] = ID; } } |