mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
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
adb551d615
commit
fad6451545
@ -432,6 +432,7 @@ UniquableMDNode::UniquableMDNode(LLVMContext &C, unsigned ID,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UniquableMDNode::resolve() {
|
void UniquableMDNode::resolve() {
|
||||||
|
assert(Storage == Uniqued && "Expected this to be uniqued");
|
||||||
assert(!isResolved() && "Expected this to be unresolved");
|
assert(!isResolved() && "Expected this to be unresolved");
|
||||||
|
|
||||||
// Move the map, so that this immediately looks resolved.
|
// 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.
|
// Drop uniquing for self-reference cycles.
|
||||||
if (New == this) {
|
if (New == this) {
|
||||||
storeDistinctInContext();
|
|
||||||
if (!isResolved())
|
if (!isResolved())
|
||||||
resolve();
|
resolve();
|
||||||
|
storeDistinctInContext();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -738,6 +739,7 @@ MDNodeFwdDecl *MDNode::getTemporary(LLVMContext &Context,
|
|||||||
void MDNode::deleteTemporary(MDNode *N) { delete cast<MDNodeFwdDecl>(N); }
|
void MDNode::deleteTemporary(MDNode *N) { delete cast<MDNodeFwdDecl>(N); }
|
||||||
|
|
||||||
void UniquableMDNode::storeDistinctInContext() {
|
void UniquableMDNode::storeDistinctInContext() {
|
||||||
|
assert(isResolved() && "Expected resolved nodes");
|
||||||
Storage = Distinct;
|
Storage = Distinct;
|
||||||
if (auto *T = dyn_cast<MDTuple>(this))
|
if (auto *T = dyn_cast<MDTuple>(this))
|
||||||
T->setHash(0);
|
T->setHash(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user