[llvm-commits] [llvm] r80738 - in /llvm/trunk/lib/VMCore: LLVMContext.cpp LLVMContextImpl.h Metadata.cpp
Devang Patel
dpatel at apple.com
Tue Sep 1 16:56:42 PDT 2009
Author: dpatel
Date: Tue Sep 1 18:56:42 2009
New Revision: 80738
URL: http://llvm.org/viewvc/llvm-project?rev=80738&view=rev
Log:
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.
Modified:
llvm/trunk/lib/VMCore/LLVMContext.cpp
llvm/trunk/lib/VMCore/LLVMContextImpl.h
llvm/trunk/lib/VMCore/Metadata.cpp
Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=80738&r1=80737&r2=80738&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/LLVMContext.cpp (original)
+++ llvm/trunk/lib/VMCore/LLVMContext.cpp Tue Sep 1 18:56:42 2009
@@ -48,10 +48,10 @@
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);
}
Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.h?rev=80738&r1=80737&r2=80738&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/LLVMContextImpl.h (original)
+++ llvm/trunk/lib/VMCore/LLVMContextImpl.h Tue Sep 1 18:56:42 2009
@@ -108,10 +108,7 @@
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;
Modified: llvm/trunk/lib/VMCore/Metadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Metadata.cpp?rev=80738&r1=80737&r2=80738&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Metadata.cpp (original)
+++ llvm/trunk/lib/VMCore/Metadata.cpp Tue Sep 1 18:56:42 2009
@@ -77,13 +77,13 @@
}
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 @@
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();
}
More information about the llvm-commits
mailing list