[PATCH] D56355: [InstCombine] Simplify cttz/ctlz + icmp ugt/ult into mask check

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 17 15:42:34 PST 2019


spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.

LGTM - see inline comment for minor improvement.



================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:2855
+
+    if (Cmp.getPredicate() == ICmpInst::ICMP_UGT && C.ult(BitWidth)) {
+      APInt Mask = APInt::getLowBitsSet(BitWidth, C.getLimitedValue() + 1);
----------------
It would be nice to have a code comment that shows the general transform formula and/or an example of how this works based on the regression tests. Seeing those makes it clear, but it's not obvious to me just looking at the code.


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

https://reviews.llvm.org/D56355





More information about the llvm-commits mailing list