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

Shawn Landden via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 13 12:20:20 PDT 2019


shawnl abandoned this revision.
shawnl marked an inline comment as done.
shawnl 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.
----------------
nikic wrote:
> 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.
Yes, it only makes sense when the range being matched is !=, or the condition is an or.


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

https://reviews.llvm.org/D60590





More information about the llvm-commits mailing list