[PATCH] D17946: Add a flag to the LLVMContext to disable name for Value other than GlobalValue

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 8 21:03:37 PST 2016


> On Mar 8, 2016, at 10:34 AM, Justin Bogner <mail at justinbogner.com> wrote:
> 
> Rafael EspĂ­ndola <rafael.espindola at gmail.com> writes:
>> This looks like a good idea, but you should delete the PreserveName
>> option in a followup commit :-)
> 
> I agree. This approach seems cleaner and strictly more useful than the
> IRBuilder template parameter. This removes names more effectively in
> places that don't use IRBuilder, and being able to explicitly turn the
> names back on even in release mode should also be very nice for writing
> tests.

Yes, I plan on a follow up commit for the IRBuilder once someone accept this patch ;-)


Chandler wanted be to verify that changing the IRBuilder to a runtime check instead of a compile time one wnouldn't regress SROA.

So I measured and... the runtime check is faster!

The reason is that there is one place in SROA that does not use the IRBuilder:

    NewAI = new AllocaInst(
        SliceTy, nullptr, Alignment,
        AI.getName() + ".sroa." + Twine(P.begin() - AS.begin()), &AI);

Once fixed they're very close:

420ms for SROA with IRBuilder that preserve name
372ms for SROA with IRBuilder that strip name
375ms for SROA with IRBuilder that preserve name but a runtime parameter to strip them


-- 
Mehdi



> 
>> On 7 March 2016 at 20:09, Mehdi AMINI via llvm-commits
>> <llvm-commits at lists.llvm.org> wrote:
>>> joker.eph added a comment.
>>> 
>>> Note: this would make the first template parameter of the IR builder "PreserveName" obsolete.
>>> Some passes such as SROA were doing:
>>> 
>>>  /// \brief Provide a typedef for IRBuilder that drops names in release builds.
>>>  #ifndef NDEBUG
>>>  typedef llvm::IRBuilder<true, ConstantFolder, IRBuilderPrefixedInserter<true>>
>>>      IRBuilderTy;
>>>  #else
>>>  typedef llvm::IRBuilder<false, ConstantFolder, IRBuilderPrefixedInserter<false>>
>>>      IRBuilderTy;
>>>  #endif
>>>  }
>>> 
>>> I thought about applying this runtime check in the IRBuilder itself, but many passes are not going through the IRBuilder and creates value directly.
>>> 
>>> 
>>> http://reviews.llvm.org/D17946
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list