[Mlir-commits] [mlir] [MLIR] Add trivial simplifications for affine mod, div, ceil (PR #182234)
Matthias Springer
llvmlistbot at llvm.org
Thu Feb 19 00:21:34 PST 2026
================
@@ -912,13 +912,17 @@ AffineExpr AffineExpr::operator-(AffineExpr other) const {
}
static AffineExpr simplifyFloorDiv(AffineExpr lhs, AffineExpr rhs) {
- auto lhsConst = dyn_cast<AffineConstantExpr>(lhs);
auto rhsConst = dyn_cast<AffineConstantExpr>(rhs);
+ // For the defined cases, simplify x floordiv x is 1.
+ if (lhs == rhs && (!rhsConst || rhsConst.getValue() >= 1))
----------------
matthias-springer wrote:
What happens if `rhs` is not constant and turns out to be "zero" at runtime?
https://github.com/llvm/llvm-project/pull/182234
More information about the Mlir-commits
mailing list