summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Metadata.cpp
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2015-12-30 19:32:24 +0000
committerTeresa Johnson <tejohnson@google.com>2015-12-30 19:32:24 +0000
commitcc428573a259b324d672c42fa6c466120aeef205 (patch)
tree9760654a0eed138adada1b144654419d9357d77d /llvm/lib/IR/Metadata.cpp
parent3e0e6e75d7fa9e199f00285a9c056f7f9e1e75f1 (diff)
downloadbcm5719-llvm-cc428573a259b324d672c42fa6c466120aeef205.tar.gz
bcm5719-llvm-cc428573a259b324d672c42fa6c466120aeef205.zip
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/IR/Metadata.cpp')
-rw-r--r--llvm/lib/IR/Metadata.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index ab1ba5e2035..f9543a65858 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -190,6 +190,8 @@ void ReplaceableMetadataImpl::moveRef(void *Ref, void *New,
void ReplaceableMetadataImpl::replaceAllUsesWith(Metadata *MD) {
assert(!(MD && isa<MDNode>(MD) && cast<MDNode>(MD)->isTemporary()) &&
"Expected non-temp node");
+ assert(CanReplace &&
+ "Attempted to replace Metadata marked for no replacement");
if (UseMap.empty())
return;
OpenPOWER on IntegriCloud