[Mlir-commits] [mlir] [MLIR][Arith] Add ValueBoundsOpInterface for DivSI (PR #137879)
Quinn Dawkins
llvmlistbot at llvm.org
Wed Apr 30 06:36:44 PDT 2025
================
@@ -75,6 +75,19 @@ struct MulIOpInterface
}
};
+struct DivSIOpInterface
+ : public ValueBoundsOpInterface::ExternalModel<DivSIOpInterface, DivSIOp> {
+ void populateBoundsForIndexValue(Operation *op, Value value,
+ ValueBoundsConstraintSet &cstr) const {
+ auto divSIOp = cast<DivSIOp>(op);
+ assert(value == divSIOp.getResult() && "invalid value");
+
+ AffineExpr lhs = cstr.getExpr(divSIOp.getLhs());
+ AffineExpr rhs = cstr.getExpr(divSIOp.getRhs());
+ cstr.bound(value) == lhs.floorDiv(rhs);
----------------
qedawkins wrote:
Switched to floordivsi, which should be the same semantics.
https://github.com/llvm/llvm-project/pull/137879
More information about the Mlir-commits
mailing list