[llvm] r219575 - AssumptionTracker: Don't create temporary CallbackVHs.
chandlerc at google.com
Sat Oct 11 19:21:36 PDT 2014
On Sat, Oct 11, 2014 at 4:51 PM, Philip Reames <listmail at philipreames.com>
> Could you give a bit of context on this change for those of us unfamiliar
> with the issue? I don't understand why the new code is advantageous.
> On 10/11/2014 12:13 PM, Benjamin Kramer wrote:
>> - CachedAssumeCalls.erase(F);
>> + auto I = CachedAssumeCalls.find_as(F);
>> + if (I != CachedAssumeCalls.end())
>> + CachedAssumeCalls.erase(I);
> This particular part seems ugly. What's the semantic difference here?
> Why is this better? If it's better, why isn't it simply part of the
> standard erase routine?
Er, I think the commit log gave you the key point: this avoids creating a
temporary CallbackVH. If you want to understand why, look at the signatures
for erase, find_as, and find? The trick of 'find_as' is to let you not
construct a same-type object for the lookup, but instead some other type
that can be used in the lookup can be passed. Primarily used with string
and stringref types for example.
The problem with creating CallbackVH's should be clear from its
documentation: every instance has to be inserted into the use list on
construction and removed on destruction. This churn to the use lists
dirties lots of cache lines and has other rather unfortunate costs.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-commits