[Mlir-commits] [mlir] [MLIR] Add trivial simplifications for affine mod, div, ceil (PR #182234)
Mehdi Amini
llvmlistbot at llvm.org
Thu Feb 19 07:48:27 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))
----------------
joker-eph wrote:
The affine_apply operation does not document "undefined behavior" it seems? (and is marked "pure")
The AffineDelinearizeIndexOp documents it, but then it shouldn't be marked as "Pure" (just "NoSideEffects").
https://github.com/llvm/llvm-project/pull/182234
More information about the Mlir-commits
mailing list