[llvm-commits] CVS: llvm/lib/VMCore/ValueSymbolTable.cpp
Chris Lattner
sabre at nondot.org
Tue Feb 6 21:23:05 PST 2007
Changes in directory llvm/lib/VMCore:
ValueSymbolTable.cpp updated: 1.4 -> 1.5
---
Log message:
Eliminate a bunch of work from ValueSymbolTable::insert for the common case
where a symbol name doesn't conflict. This speeds up bc reading 16% on 176.gcc!
---
Diffs of the changes: (+7 -1)
ValueSymbolTable.cpp | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletion(-)
Index: llvm/lib/VMCore/ValueSymbolTable.cpp
diff -u llvm/lib/VMCore/ValueSymbolTable.cpp:1.4 llvm/lib/VMCore/ValueSymbolTable.cpp:1.5
--- llvm/lib/VMCore/ValueSymbolTable.cpp:1.4 Mon Feb 5 14:47:20 2007
+++ llvm/lib/VMCore/ValueSymbolTable.cpp Tue Feb 6 23:22:49 2007
@@ -81,7 +81,13 @@
assert(V && "Can't insert null Value into symbol table!");
assert(V->hasName() && "Can't insert nameless Value into symbol table");
- // Check to see if there is a naming conflict. If so, rename this value
+ // Try inserting the name, assuming it won't conflict.
+ if (vmap.insert(make_pair(V->Name, V)).second) {
+ DOUT << " Inserted value: " << V->Name << ": " << *V << "\n";
+ return;
+ }
+
+ // Otherwise, there is a naming conflict. Rename this value.
std::string UniqueName = getUniqueName(V->getName());
DEBUG(DOUT << " Inserting value: " << UniqueName << ": " << *V << "\n");
More information about the llvm-commits
mailing list