diff options
author | Chris Lattner <sabre@nondot.org> | 2007-02-07 05:22:49 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-02-07 05:22:49 +0000 |
commit | 770dadf308879cd86dc6b624e888805a97678626 (patch) | |
tree | 895891004e6bf3345b171da3b34ac4680d5dc118 /llvm/lib/VMCore/ValueSymbolTable.cpp | |
parent | 6236b473ef9685677b4deb1d958e8253b9bc6bc3 (diff) | |
download | bcm5719-llvm-770dadf308879cd86dc6b624e888805a97678626.tar.gz bcm5719-llvm-770dadf308879cd86dc6b624e888805a97678626.zip |
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!
llvm-svn: 33981
Diffstat (limited to 'llvm/lib/VMCore/ValueSymbolTable.cpp')
-rw-r--r-- | llvm/lib/VMCore/ValueSymbolTable.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/ValueSymbolTable.cpp b/llvm/lib/VMCore/ValueSymbolTable.cpp index 51197b6bf3c..6bd5b0c49c4 100644 --- a/llvm/lib/VMCore/ValueSymbolTable.cpp +++ b/llvm/lib/VMCore/ValueSymbolTable.cpp @@ -81,7 +81,13 @@ void ValueSymbolTable::insert(Value* V) { 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"); |