[PATCH] D115755: [InstSimplify] Fold logic And to Zero
Mehrnoosh Heidarpour via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 21 08:24:57 PST 2021
MehrHeidar added a comment.
In D115755#3204863 <https://reviews.llvm.org/D115755#3204863>, @spatel wrote:
> In D115755#3204851 <https://reviews.llvm.org/D115755#3204851>, @MehrHeidar wrote:
>
>> But, this one is not complicated enough to catch this pattern : ) -->`(Y ^ (Y | X) ) & ((X | Y) ^ X) --> 0`
>>
>> %or1 = or i32 %y, %x
>> %or2 = or i32 %x, %y
>> %xor1 = xor i32 %y, %or1
>> %xor2 = xor i32 %or2, %x
>> %and = and i32 %xor1, %xor2
>> ret i32 %and
>
> Unless we have some evidence that this pattern can escape a typical -O1 pipeline, I don't think we need to care about it. `%or1` and `%or2` should be CSE'd independently of instsimplify. In other words, I think the positive tests only need to include a single 'or' instruction. If you want to include a test with different 'or' instructions to show the limits of instsimplify, that's fine.
Thank you for explaining the reason behind this. I checked the test case and it did get simplified and we ended up with a single `or`; So I updated the code and test cases.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115755/new/
https://reviews.llvm.org/D115755
More information about the llvm-commits
mailing list