[PATCH] D116935: [IRBuilder] Introduce folder using inst-simplify, use for Or fold.

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 10 14:31:18 PST 2022


craig.topper added a comment.

In D116935#3232584 <https://reviews.llvm.org/D116935#3232584>, @fhahn wrote:

> Rebased and made sure comments are consistent between different folders.
>
> In D116935#3232227 <https://reviews.llvm.org/D116935#3232227>, @craig.topper wrote:
>
>> In D116935#3232203 <https://reviews.llvm.org/D116935#3232203>, @lebedev.ri wrote:
>>
>>> In D116935#3232126 <https://reviews.llvm.org/D116935#3232126>, @craig.topper wrote:
>>>
>>>> If I remember correctly, the Or and And folds for 0 and all 1s are there to optimize bitfield codegen for the frontend. Are we losing that optimization if this patch goes in before switching clang to InstSimplifyFolder?
>>>
>>> True, but why is that optimization there in the first place?
>>> Presumably it shouldn't matter nowadays.
>>
>> Probably for -O0 where there is no optimizer,
>>
>>   commit 0fc4311f0ea4034b4bad1c82c652dc04bb763cda
>>   Author: Chris Lattner <sabre at nondot.org>
>>   Date:   Wed Nov 4 05:00:12 2009 +0000
>>   
>>       make IRBuilder zap "X|0" and "X&-1" when building IR, this happens
>>       during bitfield codegen and slows down -O0 compile times by making
>>       useless IR.  rdar://7362516
>>   
>>       llvm-svn: 86006
>
> I collected numbers using the compile-time tracker and the data seems to indicate this is not an issue any longer, there are no notable changes for any config: http://llvm-compile-time-tracker.com/compare.php?from=baa5b54d43419b5d4a1ec36f3788c36d52187e11&to=e22fc3bb9b024699fdfd12b89c68205565215b27&stat=instructions

Do the programs in compile-time tracker make much use of bitfields? Is there any indication in rdar://7362516 what program needed this? It looks like assigning a bitfield to 0 is enough to generate an or with 0 that survives through fast isel at -O0 on X86. But a few assignments to 0 wouldn't make for a huge problem, so I imagine there must have been something pathological about some program.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116935/new/

https://reviews.llvm.org/D116935



More information about the cfe-commits mailing list