OSDN Git Service

Disable MDNode uniquing.
authorDaniel Dunbar <daniel@zuster.org>
Mon, 7 Sep 2009 04:05:49 +0000 (04:05 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Mon, 7 Sep 2009 04:05:49 +0000 (04:05 +0000)
 - Hopefully this unbreaks some llvm-gcc bootstraps.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81141 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Metadata.cpp

index 8e025b6..76f2528 100644 (file)
@@ -90,11 +90,16 @@ MDNode *MDNode::get(LLVMContext &Context, Value*const* Vals, unsigned NumVals) {
   for (unsigned i = 0; i != NumVals; ++i)
     ID.AddPointer(Vals[i]);
 
+  // FIXME: MDNode uniquing disabled temporarily.
+#ifndef ENABLE_MDNODE_UNIQUING
+  return new MDNode(Context, Vals, NumVals);
+#endif
+
   pImpl->ConstantsLock.reader_acquire();
   void *InsertPoint;
   MDNode *N = pImpl->MDNodeSet.FindNodeOrInsertPos(ID, InsertPoint);
   pImpl->ConstantsLock.reader_release();
-  
+
   if (!N) {
     sys::SmartScopedWriter<true> Writer(pImpl->ConstantsLock);
     N = pImpl->MDNodeSet.FindNodeOrInsertPos(ID, InsertPoint);
@@ -115,12 +120,27 @@ void MDNode::dropAllReferences() {
 }
 
 MDNode::~MDNode() {
+  // FIXME: MDNode uniquing disabled temporarily.
+#ifdef ENABLE_MDNODE_UNIQUING
   getType()->getContext().pImpl->MDNodeSet.RemoveNode(this);
+#endif
   dropAllReferences();
 }
 
 // Replace value from this node's element list.
 void MDNode::replaceElement(Value *From, Value *To) {
+  // FIXME: MDNode uniquing disabled temporarily.
+#ifndef ENABLE_MDNODE_UNIQUING
+  if (From == To || !getType())
+    return;
+
+  for (SmallVector<ElementVH, 4>::iterator I = Node.begin(),
+         E = Node.end(); I != E; ++I)
+    if (*I && *I == From)
+      *I = ElementVH(To, this);
+  return;
+#endif
+
   if (From == To || !getType())
     return;
   LLVMContext &Context = getType()->getContext();