[PATCH] D63505: [InstCombine] Fold icmp eq/ne (and %x, C), 0 iff (-C) is power of two -> %x u</u>= (-C) earlier.

Huihui Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 11:55:06 PDT 2019


huihuiz updated this revision to Diff 206042.
huihuiz retitled this revision from "[InstCombine] Fold icmp eq/ne (and %x, ~C), 0 -> %x u</u>= 0 earlier, C+1 is power of 2." to "[InstCombine] Fold  icmp eq/ne (and %x, C), 0 iff (-C) is power of two -> %x u</u>= (-C)  earlier.".
huihuiz added a comment.

Yes , this reorder expose yet another missing fold. As regression in test/Transforms/InstCombine/pr17827.ll

Simplify 'shl' inequality test into 'and' equality test should fix this issue. I am posting this into another differential, link shortly.

icmp ult/uge (shl %x, C2), C1 iff C1 is power of two -> icmp eq/ne (and %x, (lshr -C1, C2)), 0


Repository:
  rL LLVM

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

https://reviews.llvm.org/D63505

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/test/Transforms/InstCombine/lshr-and-negC-icmpeq-zero.ll
  llvm/test/Transforms/InstCombine/pr17827.ll
  llvm/test/Transforms/InstCombine/shl-and-negC-icmpeq-zero.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63505.206042.patch
Type: text/x-patch
Size: 10903 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190621/292399a7/attachment.bin>


More information about the llvm-commits mailing list