summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-04-19 23:59:13 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-04-19 23:59:13 +0000
commit3eef9d180dbc9458f96f3e0f6a79fdee56bb8aae (patch)
tree4671cecedc27ad0ddbb8e8be595b512243b998ed
parent029a0567fa9f2e280a1ff7641bfe0c5a87f14922 (diff)
downloadbcm5719-llvm-3eef9d180dbc9458f96f3e0f6a79fdee56bb8aae.tar.gz
bcm5719-llvm-3eef9d180dbc9458f96f3e0f6a79fdee56bb8aae.zip
IR: Use std::vector instead of SmallPtrSet for distinct nodes, NFC
We never use the set-ness of SmallPtrSet for distinct nodes. Eventually we may start garbage-collecting or reference-counting nodes (in which cases we'd want to remove things from this collection, and a fast erase would be valuable), but in the meantime a vector is sufficient. llvm-svn: 266835
-rw-r--r--llvm/lib/IR/LLVMContextImpl.h7
-rw-r--r--llvm/lib/IR/Metadata.cpp2
2 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index 2938421080b..0d6d9799b46 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -33,6 +33,7 @@
#include "llvm/IR/Metadata.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/Support/Dwarf.h"
+#include <vector>
namespace llvm {
@@ -1026,9 +1027,9 @@ public:
// MDNodes may be uniqued or not uniqued. When they're not uniqued, they
// aren't in the MDNodeSet, but they're still shared between objects, so no
- // one object can destroy them. This set allows us to at least destroy them
- // on Context destruction.
- SmallPtrSet<MDNode *, 1> DistinctMDNodes;
+ // one object can destroy them. Keep track of them here so we can delete
+ // them on context teardown.
+ std::vector<MDNode *> DistinctMDNodes;
DenseMap<Type*, ConstantAggregateZero*> CAZConstants;
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index dc0b6317ee6..e753dbc05ca 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -806,7 +806,7 @@ void MDNode::storeDistinctInContext() {
#include "llvm/IR/Metadata.def"
}
- getContext().pImpl->DistinctMDNodes.insert(this);
+ getContext().pImpl->DistinctMDNodes.push_back(this);
}
void MDNode::replaceOperandWith(unsigned I, Metadata *New) {
OpenPOWER on IntegriCloud