summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/MetadataTracking.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-19 19:02:06 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-01-19 19:02:06 +0000
commit2711ca7c28da9134bda2308bb46ec34d189a0126 (patch)
tree9fc000a3b386042c7f0b0ccf33d0d9ae1e7f3cb1 /llvm/lib/IR/MetadataTracking.cpp
parentfcd4569af67b19e04aec436dbd31ad158d6d1e72 (diff)
downloadbcm5719-llvm-2711ca7c28da9134bda2308bb46ec34d189a0126.tar.gz
bcm5719-llvm-2711ca7c28da9134bda2308bb46ec34d189a0126.zip
IR: Store RAUW support and Context in the same pointer, NFC
Add an `LLVMContext &` to `ReplaceableMetadataImpl`, create a class that either holds a reference to an `LLVMContext` or owns a `ReplaceableMetadataImpl`, and use the new class in `MDNode`. - This saves a pointer in `UniquableMDNode` at the cost of a pointer in `ValueAsMetadata` (which didn't used to store the `LLVMContext`). There are far more of the former. - Unifies RAUW support between `MDNodeFwdDecl` (which is going away, see r226481) and `UniquableMDNode`. llvm-svn: 226484
Diffstat (limited to 'llvm/lib/IR/MetadataTracking.cpp')
-rw-r--r--llvm/lib/IR/MetadataTracking.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/llvm/lib/IR/MetadataTracking.cpp b/llvm/lib/IR/MetadataTracking.cpp
index ba97ca033a4..47f0b9366d7 100644
--- a/llvm/lib/IR/MetadataTracking.cpp
+++ b/llvm/lib/IR/MetadataTracking.cpp
@@ -17,11 +17,8 @@
using namespace llvm;
ReplaceableMetadataImpl *ReplaceableMetadataImpl::get(Metadata &MD) {
- if (auto *N = dyn_cast<MDNode>(&MD)) {
- if (auto *U = dyn_cast<UniquableMDNode>(N))
- return U->ReplaceableUses.get();
- return cast<MDNodeFwdDecl>(N);
- }
+ if (auto *N = dyn_cast<MDNode>(&MD))
+ return N->Context.getReplaceableUses();
return dyn_cast<ValueAsMetadata>(&MD);
}
OpenPOWER on IntegriCloud