[PATCH] D60590: [InstCombine] Simplify more cases of logical ops of masked icmps.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 13 11:56:50 PDT 2019


nikic added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:768
+  // (icmp eq (A & 3), 0) && (icmp ne (A & 4), 0)
+  //-> (icmp eq (cttz A), 2)
+  // Our job is to remove the extra branch. Let the other optimizers clean up.
----------------
This transform doesn't make any sense to me. `(icmp eq (A & 3), 0) && (icmp ne (A & 4), 0)` is the same as `(icmp eq (A & 7) == 4)`. Which is exactly the expansion we produce for a cttz equality check in https://github.com/llvm-mirror/llvm/blob/3f5d54bc7b3a850a2df14a6f7b7d8661423d824f/lib/Transforms/InstCombine/InstCombineCompares.cpp#L2851-L2866. Using a mask is more efficient and analyzable than using cttz.


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

https://reviews.llvm.org/D60590





More information about the llvm-commits mailing list