[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


================
@@ -89,6 +113,73 @@ struct FloorDivSIOpInterface
   }
 };
 
+struct CeilDivSIOpInterface
+    : public ValueBoundsOpInterface::ExternalModel<CeilDivSIOpInterface,
+                                                   CeilDivSIOp> {
+  void populateBoundsForIndexValue(Operation *op, Value value,
+                                   ValueBoundsConstraintSet &cstr) const {
+    auto divSIOp = cast<CeilDivSIOp>(op);
+    assert(value == divSIOp.getResult() && "invalid value");
+
+    AffineExpr lhs = cstr.getExpr(divSIOp.getLhs());
+    AffineExpr rhs = cstr.getExpr(divSIOp.getRhs());
+    cstr.bound(value) == lhs.ceilDiv(rhs);
----------------
matthias-springer wrote:

This looks reasonable to me. When both `lhs` and `rhs` are (or contain) dimensions, the `cstr.bound` call will do nothing (and we print a warning to `llvm::dbgs`).


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


More information about the Mlir-commits mailing list