[cfe-commits] r99823 - in /cfe/trunk/lib/CodeGen: CGDebugInfo.cpp CGDebugInfo.h

Ted Kremenek kremenek at apple.com
Mon Mar 29 12:11:57 PDT 2010


On Mar 29, 2010, at 11:46 AM, Chris Lattner wrote:

> 
> On Mar 29, 2010, at 11:29 AM, Ted Kremenek wrote:
> 
>> Author: kremenek
>> Date: Mon Mar 29 13:29:57 2010
>> New Revision: 99823
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=99823&view=rev
>> Log:
>> Change 'TypeCache' from being an std::map to a llvm::DenseMap.  This reduces codegen time
>> on one .i file from 403.gcc by 0.5%.
> 
> Thanks Ted,
> 
>> 
>>  /// TypeCache - Cache of previously constructed Types.
>>  // FIXME: Eliminate this map.  Be careful of iterator invalidation.
>> -  std::map<void *, llvm::WeakVH> TypeCache;
>> +  llvm::DenseMap<void *, llvm::WeakVH> TypeCache;
> 
> I think you can remove the fixme now.

Done.

>  Did you make sure that iterators aren't getting invalidated here?  If something does this:
> 
> 
> WeakVH &H = TypeCache[x];
> ... stuff that could insert or delete from TypeCache...
> 
> ... use H ...
> 
> Then this would be a bug,

The usage appears safe.  I also talked about this with Devang to see if we no longer needed an std::map.



More information about the cfe-commits mailing list