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

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 19 05:52:53 PDT 2023


================
@@ -8285,6 +8285,15 @@ static std::optional<bool> isImpliedCondICmps(const ICmpInst *LHS,
   if (areMatchingOperands(L0, L1, R0, R1, AreSwappedOps))
     return isImpliedCondMatchingOperands(LPred, RPred, AreSwappedOps);
 
+  if (RPred == ICmpInst::ICMP_SLT) {
+    Value *X;
+    Value *Y;
+    // x-y+1 is positive when x >= y or non-positive when x < y
----------------
vfdff wrote:

hi, @nikic,
   the **extra +1** is matched with the **match(R1, m_AllOnes())**.

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


More information about the llvm-commits mailing list