summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/VMCore/ValueSymbolTable.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/VMCore/ValueSymbolTable.cpp b/lib/VMCore/ValueSymbolTable.cpp
index 6bd5b0c..358b5a2 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