forked from OSchip/llvm-project
IR: Assert that resolve() is only called on uniqued nodes, NFC
Add an assertion in `UniquableMDNode::resolve()` to prevent temporaries from being resolved (once they're merged back in). Needed to shuffle order of `resolve()` and `storeDistinctInContext()` to prevent it from firing. llvm-svn: 226489
This commit is contained in:
parent
105acf7885
commit
f08b8b4be6
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue