summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Metadata.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-31 20:50:50 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-03-31 20:50:50 +0000
commitcb33d6f5467653c1b74162c788e4ddbf3c987fb1 (patch)
tree4e33500f5695a9407bbf3e3709507476b4eb410f /llvm/lib/IR/Metadata.cpp
parent95e38baa525f50ab8e3a5db82e1f22ef78e5af14 (diff)
downloadbcm5719-llvm-cb33d6f5467653c1b74162c788e4ddbf3c987fb1.tar.gz
bcm5719-llvm-cb33d6f5467653c1b74162c788e4ddbf3c987fb1.zip
IR: Enable uniquing callbacks during MDNode::replaceWithUniqued()
Uniqued nodes have more complete registration with `ReplaceableMetadataImpl` so that they can update themselves when operands change. Fix a bug where `MDNode::replaceWithUniqued()` wasn't enabling these callbacks. The two most obvious ways missing callbacks causes problems is that auto-resolution fails and re-uniquing (on changed operands) just doesn't happen. I've added tests for both -- in both cases, I confirmed that the final check was failing before the fix. rdar://problem/20365935 llvm-svn: 233751
Diffstat (limited to 'llvm/lib/IR/Metadata.cpp')
-rw-r--r--llvm/lib/IR/Metadata.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index 7691ab016cc..93098b9da7e 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -446,6 +446,10 @@ void MDNode::makeUniqued() {
assert(isTemporary() && "Expected this to be temporary");
assert(!isResolved() && "Expected this to be unresolved");
+ // Enable uniquing callbacks.
+ for (auto &Op : mutable_operands())
+ Op.reset(Op.get(), this);
+
// Make this 'uniqued'.
Storage = Uniqued;
if (!countUnresolvedOperands())
OpenPOWER on IntegriCloud