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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 19 05:59:07 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
----------------
nikic wrote:

Isn't -1 one of the icmp operands, not part of the add?

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


More information about the llvm-commits mailing list