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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 21 02:03:21 PST 2023


================
@@ -786,7 +786,8 @@ void ConstraintInfo::transferToOtherSystem(
   case CmpInst::ICMP_ULT:
   case CmpInst::ICMP_ULE:
     //  If B is a signed positive constant, then A >=s 0 and A <s (or <=s) B.
-    if (doesHold(CmpInst::ICMP_SGE, B, ConstantInt::get(B->getType(), 0))) {
+    if (doesHold(CmpInst::ICMP_SGE, B, ConstantInt::get(B->getType(), 0)) ||
+        isKnownNonNegative(B, DL, /*Depth=*/MaxAnalysisRecursionDepth - 1)) {
----------------
fhahn wrote:

Done, thanks!

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


More information about the llvm-commits mailing list