[llvm] [ConstraintElim] Use isKnownNonNegative for signed->unsigned transfer. (PR #72879)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 20 07:30:41 PST 2023


================
@@ -804,7 +804,8 @@ void ConstraintInfo::transferToOtherSystem(
     }
     break;
   case CmpInst::ICMP_SLT:
-    if (doesHold(CmpInst::ICMP_SGE, A, ConstantInt::get(B->getType(), 0)))
+    if (doesHold(CmpInst::ICMP_SGE, A, ConstantInt::get(B->getType(), 0)) ||
+        isKnownNonNegative(A, DL, /*Depth=*/MaxAnalysisRecursionDepth - 1))
----------------
nikic wrote:

There are a bunch of places in this code doing the doesHold() check with SGE 0. Any particular reason why only this one in particular should be adjusted?

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


More information about the llvm-commits mailing list