summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-19 19:25:33 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-19 19:25:33 +0000
commitf08b8b4be6dd23f7766d5036575ade5f7d7fd6e2 (patch)
tree7531a12e6566ca7d003be7eb2c171983e8ba3b74 /llvm/lib/IR
parent105acf7885a20e6573943246026c3dd30d8d1a78 (diff)
downloadbcm5719-llvm-f08b8b4be6dd23f7766d5036575ade5f7d7fd6e2.tar.gz
bcm5719-llvm-f08b8b4be6dd23f7766d5036575ade5f7d7fd6e2.zip
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
Diffstat (limited to 'llvm/lib/IR')
-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