summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-09-01 23:56:42 +0000
committerDevang Patel <dpatel@apple.com>2009-09-01 23:56:42 +0000
commit8c7f86e6980c9b22963b82feb6efa75e392e70c4 (patch)
treeb8fc6b8a0560c197157d1bdbffb4ce8876cfaf48 /llvm/lib
parent2348e62498df2f0bea4370358af6c3d432d6d0b5 (diff)
downloadbcm5719-llvm-8c7f86e6980c9b22963b82feb6efa75e392e70c4.tar.gz
bcm5719-llvm-8c7f86e6980c9b22963b82feb6efa75e392e70c4.zip
For now disable MDNode uniquing. This fixes llvm-gcc bootstrap failure on certain Mac OS X 10.5. I am working on a proper fix.
llvm-svn: 80738
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/VMCore/LLVMContext.cpp8
-rw-r--r--llvm/lib/VMCore/LLVMContextImpl.h5
-rw-r--r--llvm/lib/VMCore/Metadata.cpp14
3 files changed, 8 insertions, 19 deletions
diff --git a/llvm/lib/VMCore/LLVMContext.cpp b/llvm/lib/VMCore/LLVMContext.cpp
index 95ceeaee813..1803a9a6666 100644
--- a/llvm/lib/VMCore/LLVMContext.cpp
+++ b/llvm/lib/VMCore/LLVMContext.cpp
@@ -48,10 +48,10 @@ bool LLVMContext::RemoveDeadMetadata() {
bool Changed = false;
while (1) {
- for (LLVMContextImpl::MDNodeMapTy::MapTy::iterator
- I = pImpl->MDNodes.map_begin(),
- E = pImpl->MDNodes.map_end(); I != E; ++I) {
- const MDNode *N = cast<MDNode>(I->second);
+ for (SmallPtrSet<const MDNode *, 8>::iterator
+ I = pImpl->MDNodes.begin(),
+ E = pImpl->MDNodes.end(); I != E; ++I) {
+ const MDNode *N = cast<MDNode>(*I);
if (N->use_empty())
DeadMDNodes.push_back(N);
}
diff --git a/llvm/lib/VMCore/LLVMContextImpl.h b/llvm/lib/VMCore/LLVMContextImpl.h
index 2faf6ac6e38..eeafeafd9ee 100644
--- a/llvm/lib/VMCore/LLVMContextImpl.h
+++ b/llvm/lib/VMCore/LLVMContextImpl.h
@@ -108,10 +108,7 @@ public:
ValueMap<char, Type, ConstantAggregateZero> AggZeroConstants;
- typedef ValueMap<std::vector<Value*>, Type, MDNode, true /*largekey*/>
- MDNodeMapTy;
-
- MDNodeMapTy MDNodes;
+ SmallPtrSet<const MDNode *, 8> MDNodes;
typedef ValueMap<std::vector<Constant*>, ArrayType,
ConstantArray, true /*largekey*/> ArrayConstantsTy;
diff --git a/llvm/lib/VMCore/Metadata.cpp b/llvm/lib/VMCore/Metadata.cpp
index 60ec1c5c6ca..bb8021485f6 100644
--- a/llvm/lib/VMCore/Metadata.cpp
+++ b/llvm/lib/VMCore/Metadata.cpp
@@ -77,13 +77,13 @@ MDNode::MDNode(LLVMContext &C, Value*const* Vals, unsigned NumVals)
}
MDNode *MDNode::get(LLVMContext &Context, Value*const* Vals, unsigned NumVals) {
- LLVMContextImpl *pImpl = Context.pImpl;
std::vector<Value*> V;
V.reserve(NumVals);
for (unsigned i = 0; i < NumVals; ++i)
V.push_back(Vals[i]);
- return pImpl->MDNodes.getOrCreate(Type::getMetadataTy(Context), V);
+ // FIXME : Avoid creating duplicate node.
+ return new MDNode(Context, &V[0], V.size());
}
/// dropAllReferences - Remove all uses and clear node vector.
@@ -92,16 +92,8 @@ void MDNode::dropAllReferences() {
Node.clear();
}
-static std::vector<Value*> getValType(MDNode *N) {
- std::vector<Value*> Elements;
- Elements.reserve(N->getNumElements());
- for (unsigned i = 0, e = N->getNumElements(); i != e; ++i)
- Elements.push_back(N->getElement(i));
- return Elements;
-}
-
MDNode::~MDNode() {
- getType()->getContext().pImpl->MDNodes.remove(this);
+ getType()->getContext().pImpl->MDNodes.erase(this);
dropAllReferences();
}
OpenPOWER on IntegriCloud