[PATCH] Store reference to corresponding PassInfo in Pass

Sylvestre Ledru sylvestre at debian.org
Sun Feb 2 13:56:19 PST 2014


Hello,

Any news on this subject ?
It might help if you could push that on http://llvm-reviews.chandlerc.com/

Cheers,
Sylvestre

On 14/01/2014 14:31, Rafael EspĂ­ndola wrote:
> ccing Chandler who is rewriting the pass manager at the moment.
>
> On 29 December 2013 09:06, Carl-Anton Ingmarsson
> <ca.ingmarsson at gmail.com> wrote:
>> When profiling the rust compiler I noticed that it spends a lot of time
>> in llvm::PassRegistry::getPassInfo(). Although
>> llvm::PassRegistry::getPassInfo() is reasonably simple it involves a
>> lock and a hash table lookup which by no means is free.
>>
>> Since a Pass is closely associated with it's PassInfo I think it makes
>> sense to keep a reference to the PassInfo from the Pass and then add a
>> Pass::getPassInfo() function that users can use to get the PassInfo from
>> a Pass object.
>>
>> I first tried to lookup and store the PassInfo reference in the Pass
>> constructor but this unfortunately didn't work since some Pass
>> implementations doesn't register it's corresponding PassInfo until the
>> first Pass is constructed. This could be fixed by changing the Pass
>> constructor to take the PassInfo and then subclasses could pass the
>> result of it's "initialize***Pass" to the parent constructor. Since this
>> involves changing all the Pass implementations I decided to do a simpler
>> version for now and hear your opinions.
>>
>> I've attached the simple (hacky) version that simply calls
>> llvm::PassRegistry::getPassInfo() inside llvm::Pass::getPassInfo() if
>> the PassInfo hasn't previously been fetched.
>>
>> In my test this reduces the percentage of time spent in
>> llvm::PassRegistry::getPassInfo() from 6.21% to 0.03%. (The new
>> llvm::Pass::getPassInfo() doesn't show up in the profile at all)
>>
>> Best regards,
>> Carl-Anton
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
> _______________________________________________
> 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