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

Chris Lattner clattner at apple.com
Tue Jan 20 22:28:10 PST 2009


On Jan 19, 2009, at 4:58 PM, Devang Patel wrote:

> Author: dpatel
> Date: Mon Jan 19 18:58:55 2009
> New Revision: 62555
>
> URL: http://llvm.org/viewvc/llvm-project?rev=62555&view=rev
> Log:
> Do not use DenseMap because the iterator is invalidated while  
> constructing types. After all there was a reason why std::map was  
> used initially!

Aha!  Can you change the code to just not depend on this?  In other  
words, instead of:

DIE *&Entry = GVToDieMap[GV];
...
something that could invalidate Entry
...

Entry = ...

Just do:

DIE *&Entry = GVToDieMap[GV];
...
something that could invalidate Entry
...

GVToDieMap[GV] = ...

?

DenseMap is much much faster for pointer pairs than std::map.

-Chris

>
>
>
> Modified:
>    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp?rev=62555&r1=62554&r2=62555&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Mon Jan 19  
> 18:58:55 2009
> @@ -779,11 +779,11 @@
>
>   /// GVToDieMap - Tracks the mapping of unit level debug informaton
>   /// variables to debug information entries.
> -  DenseMap<GlobalVariable *, DIE *> GVToDieMap;
> +  std::map<GlobalVariable *, DIE *> GVToDieMap;
>
>   /// GVToDIEntryMap - Tracks the mapping of unit level debug  
> informaton
>   /// descriptors to debug information entries using a DIEntry proxy.
> -  DenseMap<GlobalVariable *, DIEntry *> GVToDIEntryMap;
> +  std::map<GlobalVariable *, DIEntry *> GVToDIEntryMap;
>
>   /// Globals - A map of globally visible named entities for this  
> unit.
>   ///
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list