[PATCH] D112634: [InstCombine] canonicalize icmp with trunc op into mask and cmp, part 2

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 15 12:25:24 PST 2021


spatel marked an inline comment as done.
spatel added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:4635
+      Value *And = Builder.CreateAnd(X, MaskC);
+      return new ICmpInst(ICmpInst::ICMP_NE, And, MaskC);
+    }
----------------
lebedev.ri wrote:
> I'm guessing we prefer inequality check over relational? https://alive2.llvm.org/ce/z/9mn4Tx
Yes, we should canonicalize to equality on that pattern:
https://alive2.llvm.org/ce/z/MWK88Q


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:4639
+
+  if (Pred == ICmpInst::ICMP_UGT) {
+    // If C is a low-bit-mask (C+1 is a power-of-2):
----------------
lebedev.ri wrote:
> Are these supposed to be in this patch? I'm not seeing alive2 links in the description for them.
Yes, I put the 'ugt' patterns in for symmetry (but I can commit in pieces if that seems better). The alive2 links were in a subsequent comment, but I just added them to the description.


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

https://reviews.llvm.org/D112634



More information about the llvm-commits mailing list