diff options
| author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-01-19 23:17:09 +0000 |
|---|---|---|
| committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-01-19 23:17:09 +0000 |
| commit | 8647529250d01dc24b57329ecff6bdd4f7ad4cfb (patch) | |
| tree | b147dfce66ac7ba5a366c383a71dd199ab442b98 /llvm/lib | |
| parent | a1ae4f6b30205cf49f2109bac0b6c787d8a8767b (diff) | |
| download | bcm5719-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.cpp | 19 |
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)); } |

