speed up conflict handling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33985 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2007-02-07 05:52:51 +00:00
parent c2b2d6a7c9
commit 421d3daa05

View 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