[PATCH] D78430: [InstSimplify] fold and/or of compares with equality to min/max constant

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 18 10:13:45 PDT 2020


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:1488-1492
   // X <= Y && Y != 0  -->  X <= Y  iff X != 0
   // X <= Y || Y != 0  -->  Y != 0  iff X != 0
   if (UnsignedPred == ICmpInst::ICMP_ULE && EqPred == ICmpInst::ICMP_NE &&
       isKnownNonZero(X, Q.DL, /*Depth=*/0, Q.AC, Q.CxtI, Q.DT))
     return IsAnd ? UnsignedICmp : ZeroICmp;
----------------
Any handling plan for these neighbor patterns?


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:1675
+static Value *simplifyAndOrOfICmpsWithLimitConst(ICmpInst *Cmp0, ICmpInst *Cmp1,
+                                                 bool IsAnd) {
+  // Canonicalize an equality compare as Cmp0.
----------------
You literally always check `!IsAnd`.
Should this be `IsOr` instead?


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

https://reviews.llvm.org/D78430





More information about the llvm-commits mailing list