From: Chris Lattner Date: Wed, 7 Feb 2007 05:52:51 +0000 (+0000) Subject: speed up conflict handling. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=421d3daa05ac5c62c3bf93d0b3a4d75ba99c35f2;p=oota-llvm.git speed up conflict handling. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33985 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/VMCore/ValueSymbolTable.cpp b/lib/VMCore/ValueSymbolTable.cpp index 6bd5b0c49c4..358b5a23d0b 100644 --- a/lib/VMCore/ValueSymbolTable.cpp +++ b/lib/VMCore/ValueSymbolTable.cpp @@ -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