[llvm] [InstSimplify] Simplify the select with integer comparison relationship (PR #66668)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 17 07:39:07 PDT 2023


================
@@ -8282,6 +8282,28 @@ static std::optional<bool> isImpliedCondICmps(const ICmpInst *LHS,
   if (areMatchingOperands(L0, L1, R0, R1, AreSwappedOps))
     return isImpliedCondMatchingOperands(LPred, RPred, AreSwappedOps);
 
+  if (RPred == ICmpInst::ICMP_SLE) {
+    Value *X;
+    Value *Y;
+    // x -nsw y <= -1 <==> x < y
----------------
nikic wrote:

`sle -1` will get canonicalized to `slt 0`. Why are we handling this pattern?

https://github.com/llvm/llvm-project/pull/66668


More information about the llvm-commits mailing list