[llvm] [ConstraintElim] Answer unsigned queries using the signed system. (PR #213744)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 4 02:00:36 PDT 2026


================
@@ -889,13 +893,15 @@ bool ConstraintInfo::doesHold(CmpInst::Predicate Pred, Value *A,
          getCS(R.IsSigned).isConditionImpliedInSubSystem(R.Coefficients);
 }
 
+bool ConstraintInfo::isKnownNonNegative(Value *V) const {
+  return doesHold(CmpInst::ICMP_SGE, V, ConstantInt::get(V->getType(), 0)) ||
+         ::isKnownNonNegative(V, DL, /*Depth=*/MaxAnalysisRecursionDepth - 1);
+}
+
 void ConstraintInfo::transferToOtherSystem(
     CmpInst::Predicate Pred, Value *A, Value *B, unsigned NumIn,
     unsigned NumOut, SmallVectorImpl<StackEntry> &DFSInStack) {
-  auto IsKnownNonNegative = [this](Value *V) {
-    return doesHold(CmpInst::ICMP_SGE, V, ConstantInt::get(V->getType(), 0)) ||
-           isKnownNonNegative(V, DL, /*Depth=*/MaxAnalysisRecursionDepth - 1);
-  };
+  auto IsKnownNonNegative = [this](Value *V) { return isKnownNonNegative(V); };
----------------
antoniofrighetto wrote:

Nit: would drop the leftover lambda and directly use isKnownNonNegative().

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


More information about the llvm-commits mailing list