[Mlir-commits] [mlir] [mlir][Interfaces] `ValueBoundsOpInterface`: Add API to compare values (PR #86915)

Han-Chung Wang llvmlistbot at llvm.org
Thu Apr 11 14:15:06 PDT 2024


================
@@ -621,24 +642,32 @@ bool ValueBoundsConstraintSet::compare(Value lhs, std::optional<int64_t> lhsDim,
 
   // EQ can be expressed as LE and GE.
   if (cmp == EQ)
-    return compare(lhs, lhsDim, ComparisonOperator::LE, rhs, rhsDim) &&
-           compare(lhs, lhsDim, ComparisonOperator::GE, rhs, rhsDim);
+    return compareValueDims(lhs, lhsDim, ComparisonOperator::LE, rhs, rhsDim) &&
+           compareValueDims(lhs, lhsDim, ComparisonOperator::GE, rhs, rhsDim);
 
   // Construct inequality. For the above example: lhs > rhs.
   // `IntegerRelation` inequalities are expressed in the "flattened" form and
   // with ">= 0". I.e., lhs - rhs - 1 >= 0.
-  SmallVector<int64_t> eq(cstr.getNumDimAndSymbolVars() + 1, 0);
----------------
hanhanW wrote:

I'm debugging an issue triggered by https://github.com/llvm/llvm-project/pull/87862 and down to here. It hit the below assertion. It looks like the size of `eq` should be `getNumCols`. Is it a bug fixed by this PR?

https://github.com/llvm/llvm-project/blob/a952c123880eb1168f1021b116485e27170d48ca/mlir/lib/Analysis/Presburger/IntegerRelation.cpp#L367-L372

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


More information about the Mlir-commits mailing list