[PATCH] D32143: [InstSimplify] use ConstantRange to simplify more and-of-icmps

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 17 17:09:44 PDT 2017


spatel created this revision.
Herald added a subscriber: mcrosier.

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.

I initially thought I could use equivalence of the intersection with one of the input ranges rather than 'contains', but ConstantRange intersection doesn't work like I expected (not sure if it's wrong or if my expectations are off).


https://reviews.llvm.org/D32143

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32143.95510.patch
Type: text/x-patch
Size: 35381 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170418/bac24b98/attachment.bin>


More information about the llvm-commits mailing list