OSDN Git Service

speed up conflict handling.
authorChris Lattner <sabre@nondot.org>
Wed, 7 Feb 2007 05:52:51 +0000 (05:52 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 7 Feb 2007 05:52:51 +0000 (05:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33985 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/ValueSymbolTable.cpp

index 6bd5b0c..358b5a2 100644 (file)
@@ -88,13 +88,18 @@ void ValueSymbolTable::insert(Value* V) {
   }
   
   // Otherwise, there is a naming conflict.  Rename this value.
-  std::string UniqueName = getUniqueName(V->getName());
+  std::string UniqueName = V->getName();
+  unsigned BaseSize = UniqueName.size();
+  do {
+    // Trim any suffix off.
+    UniqueName.resize(BaseSize);
+    UniqueName += utostr(++LastUnique);
+  } while (!vmap.insert(make_pair(UniqueName, V)).second);
 
   DEBUG(DOUT << " Inserting value: " << UniqueName << ": " << *V << "\n");
 
   // Insert the vmap entry
   V->Name = UniqueName;
-  vmap.insert(make_pair(V->Name, V));
 }
 
 // Remove a value