summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Metadata.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/Metadata.cpp')
-rw-r--r--llvm/lib/IR/Metadata.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index fe6ad34e162..8a4710444f3 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -432,6 +432,7 @@ UniquableMDNode::UniquableMDNode(LLVMContext &C, unsigned ID,
}
void UniquableMDNode::resolve() {
+ assert(Storage == Uniqued && "Expected this to be uniqued");
assert(!isResolved() && "Expected this to be unresolved");
// Move the map, so that this immediately looks resolved.
@@ -539,9 +540,9 @@ void UniquableMDNode::handleChangedOperand(void *Ref, Metadata *New) {
// Drop uniquing for self-reference cycles.
if (New == this) {
- storeDistinctInContext();
if (!isResolved())
resolve();
+ storeDistinctInContext();
return;
}
@@ -738,6 +739,7 @@ MDNodeFwdDecl *MDNode::getTemporary(LLVMContext &Context,
void MDNode::deleteTemporary(MDNode *N) { delete cast<MDNodeFwdDecl>(N); }
void UniquableMDNode::storeDistinctInContext() {
+ assert(isResolved() && "Expected resolved nodes");
Storage = Distinct;
if (auto *T = dyn_cast<MDTuple>(this))
T->setHash(0);
OpenPOWER on IntegriCloud