[PATCH] D63675: [InstCombine] Simplify icmp ult/uge (shl %x, C2), C1 iff C1 is power of two -> icmp eq/ne (and %x, (lshr -C1, C2)), 0.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 15:14:11 PDT 2019


lebedev.ri accepted this revision.
lebedev.ri marked an inline comment as done.
lebedev.ri added a subscriber: spatel.
lebedev.ri added a comment.
This revision is now accepted and ready to land.

Looks good, thank you.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:2041
+    }
+    // (X l<< C2) u</u>= C1 iff C1 is power of two -> X & (-C1 l>> C2) ==/!= 0
+    if (C.isPowerOf2() &&
----------------
Like i commented in tests, it is not really possible to guarantely test those predicates.
It seems like the predicates aren't being canonnicalized for vector compares, but that is likely a bug (CC @spatel)
So it would be great if you could add vector test coverage for these, for now at least.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D63675





More information about the llvm-commits mailing list