[Mlir-commits] [mlir] [mlir][affine|ValueBounds] Add transform to simplify affine min max ops with ValueBoundsOpInterface (PR #145068)

Fabian Mora llvmlistbot at llvm.org
Sat Jun 21 04:14:28 PDT 2025


================
@@ -254,6 +261,12 @@ class ValueBoundsConstraintSet
   /// prove the relation or until it ran out of IR.
   static bool compare(const Variable &lhs, ComparisonOperator cmp,
                       const Variable &rhs);
+  /// This function is similar to `ValueBoundsConstraintSet::compare`, except
+  /// that it returns false if `!(lhs cmp rhs)`, and `failure` if neither the
+  /// relation nor its inverse relation could be proven.
+  static llvm::FailureOr<bool> strongCompare(const Variable &lhs,
----------------
fabianmcg wrote:

AFAIK, no. Here, strong doesn't refer to the comparison operator, but rather the method guarantees compared to the `ValueBoundsConstraintSet::compare` method. To be specific:

```
compare(x, cmp, y) == true   <==>   strongCompare(x, cmp, y) == true
&&
strongCompare(x, cmp, y) == false   ==>  compare(x, cmp, y) == false
// But 
compare(x, cmp, y) == false   =/=>   strongCompare(x, cmp, y) == false
```

That's because `compare(x, cmp, y) == false` can mean the inequality couldn't be proven (not necessarily that it's false), and in those cases `strongCompare` returns failure.

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


More information about the Mlir-commits mailing list