[PATCH] PR19711: use computeKnownBits to simplify (in)equality comparisons

David Majnemer david.majnemer at gmail.com
Sun Aug 24 00:20:26 PDT 2014


LGTM except for the test, it should be moved
to test/Transforms/InstSimplify.


On Tue, May 20, 2014 at 5:08 AM, Jay Foad <jay.foad at gmail.com> wrote:

> PR19711: Souper (https://github.com/google/souper/) discovered that we
> don't simplify this comparison to false:
>
>   %mul = mul nsw i32 %0, -2
>   %cmp = icmp eq i32 %mul, 1
>
> Fix this by calling computeKnownBits to see if any bits are known to be 0
> in one operand and 1 in the other, in which case the operands can't be
> equal.
>
> I was a bit surprised that before this patch, there were no calls from
> InstructionSimplify.cpp to computeKnownBits. Is this the right approach? OK
> to commit?
>
> The tweak to align-2d-gep.ll just avoids an unintended simplification,
> where we could prove that %indvar.next was always even so could never equal
> 557.
>
> Thanks,
> Jay.
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140824/f0a6be90/attachment.html>


More information about the llvm-commits mailing list