[InstSimplify] use ConstantRange to simplify more and-of-icmps
authorSanjay Patel <spatel@rotateright.com>
Mon, 24 Apr 2017 21:52:39 +0000 (21:52 +0000)
committerSanjay Patel <spatel@rotateright.com>
Mon, 24 Apr 2017 21:52:39 +0000 (21:52 +0000)
commit35c362ebbb21e19594722d4ab74ac99503e21b72
treec56e81bc8bd80c2513082c51d3a7f757e8281997
parent3460cdd4404504a2e4d5e7e79c3c8f715c64540f
[InstSimplify] use ConstantRange to simplify more and-of-icmps

We can simplify (and (icmp X, C1), (icmp X, C2)) to one of the icmps in many cases.
I had to check some of these with Alive to prove to myself it's right, but everything
seems to check out. Eg, the code in instcombine was completely ignoring predicates with
mismatched signedness.

Handling or-of-icmps would be a follow-up step.

Differential Revision: https://reviews.llvm.org/D32143

llvm-svn: 301260
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
llvm/test/Transforms/InstCombine/and-or-icmps.ll
llvm/test/Transforms/InstCombine/minmax-fold.ll
llvm/test/Transforms/InstSimplify/icmp-ranges.ll