[llvm-commits] [llvm] r68728 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp

Chris Lattner clattner at apple.com
Thu Apr 9 16:35:55 PDT 2009


On Apr 9, 2009, at 2:49 PM, Bill Wendling wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=68728&view=rev
> Log:
> Use a StringMap instead of std::map for storing std::string->DIE*  
> maps. This
> gives a micro speedup in the Dwarf writer.

Hi Bill,

> +    StringMap<DIE*> &Globals = Unit->getGlobals();
> +    for (StringMap<DIE*>::iterator
> +           GI = Globals.begin(), GE = Globals.end(); GI != GE; + 
> +GI) {
> +      const std::string &Name = GI->first();
>       DIE * Entity = GI->second;

Note that GI->first() returns a const char*, not an std::string.  This  
means that you're creating a temporary string object every time you  
iterate over this.  Please update this (and other places that poke the  
map) to use better APIs.

Thanks,

-Chris




More information about the llvm-commits mailing list