[PATCH] D132989: [InstSimplify] Odd - X ==/!= X -> false/true

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 2 08:11:02 PDT 2022


spatel added a comment.

In D132989#3766992 <https://reviews.llvm.org/D132989#3766992>, @liaolucy wrote:

>> If we do not have a real-world example that shows the more expensive transform is needed, then we should not add it. In other words, the patch is mostly fine as implemented. But I do not understand why we have no-wrap requirements. The transform is correct without those:
>> https://alive2.llvm.org/ce/z/h4ZFVD
>
> Actually, I'm not sure if just using srem(2) is correct.

I think it would be a little more efficient/readable to code this as "*C & 1".

But we need to be certain that the transform is correct to proceed. Do you have a counter-example that shows an incorrect result?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132989



More information about the llvm-commits mailing list