summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-19 23:17:09 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-19 23:17:09 +0000
commit8647529250d01dc24b57329ecff6bdd4f7ad4cfb (patch)
treeb147dfce66ac7ba5a366c383a71dd199ab442b98 /llvm/lib
parenta1ae4f6b30205cf49f2109bac0b6c787d8a8767b (diff)
downloadbcm5719-llvm-8647529250d01dc24b57329ecff6bdd4f7ad4cfb.tar.gz
bcm5719-llvm-8647529250d01dc24b57329ecff6bdd4f7ad4cfb.zip
IR: Move replaceWithUniqued(), etc., to source file, NFC
llvm-svn: 226522
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/Metadata.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index fb70149330b..3613871207a 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -509,6 +509,25 @@ void MDNode::resolveCycles() {
}
}
+MDNode *MDNode::replaceWithUniquedImpl() {
+ // Try to uniquify in place.
+ MDNode *UniquedNode = uniquify();
+ if (UniquedNode == this) {
+ makeUniqued();
+ return this;
+ }
+
+ // Collision, so RAUW instead.
+ replaceAllUsesWith(UniquedNode);
+ deleteAsSubclass();
+ return UniquedNode;
+}
+
+MDNode *MDNode::replaceWithDistinctImpl() {
+ makeDistinct();
+ return this;
+}
+
void MDTuple::recalculateHash() {
setHash(MDTupleInfo::KeyTy::calculateHash(this));
}
OpenPOWER on IntegriCloud