[Mlir-commits] [mlir] [mlir][arith] Add ValueBoundsOpInterface external models for the arith integer CeilDiv, RemSI, RemUI, MaxUI, MinUI. (PR #204966)

Matthias Springer llvmlistbot at llvm.org
Wed Jun 24 01:57:22 PDT 2026


================
@@ -190,6 +258,55 @@ struct MaxSIOpInterface
     cstr.bound(value) >= rhs;
   }
 };
+
+struct MinUIOpInterface
+    : public ValueBoundsOpInterface::ExternalModel<MinUIOpInterface,
+                                                   arith::MinUIOp> {
+  void populateBoundsForIndexValue(Operation *op, Value value,
+                                   ValueBoundsConstraintSet &cstr) const {
+    auto minOp = cast<arith::MinUIOp>(op);
+    assert(value == minOp.getResult() && "invalid value");
+
+    // ValueBoundsConstraintSet models values as signed integers (e.g. an i8
+    // 0xff is treated as -1, not 255). For an unsigned minimum it is enough
+    // that a single operand is provably non-negative: minui(x, y) is in
----------------
matthias-springer wrote:

I don't follow this part. Can you describe with an example why it's sufficient for one operand to be non-negative? (Also make clear if `>=` is signed or unsigned comparison.)

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


More information about the Mlir-commits mailing list