[Mlir-commits] [mlir] [MLIR][Arith] Add ValueBoundsOpInterface for DivSI (PR #137879)
Krzysztof Drewniak
llvmlistbot at llvm.org
Tue Apr 29 14:29:09 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);
----------------
krzysz00 wrote:
... `divsi` isn't `floordiv`?
That is,I think this'll be wrong for negative numbers.
https://github.com/llvm/llvm-project/pull/137879
More information about the Mlir-commits
mailing list