[PATCH] D115755: [InstSimplify] Fold logic And to Zero

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 21 07:37:29 PST 2021


spatel added a comment.

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.


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