[Mlir-commits] [mlir] [mlir] Fold ceil/floordiv with negative RHS. (PR #97031)
Johannes Reifferscheid
llvmlistbot at llvm.org
Wed Feb 25 05:22:04 PST 2026
================
@@ -855,8 +855,7 @@ static AffineExpr simplifyFloorDiv(AffineExpr lhs, AffineExpr rhs) {
auto lhsConst = dyn_cast<AffineConstantExpr>(lhs);
auto rhsConst = dyn_cast<AffineConstantExpr>(rhs);
- // mlir floordiv by zero or negative numbers is undefined and preserved as is.
- if (!rhsConst || rhsConst.getValue() < 1)
+ if (!rhsConst || rhsConst.getValue() == 0)
----------------
jreiffers wrote:
Thanks for the comment. I don't remember the context of this PR since it's been quite a while. I suspect it was probably related to a fuzzer test that is not public and this PR can therefore be reverted (at least I'm not aware of anything that would actually try to use a negative RHS).
Since this is all UB anyway, I don't think it's particularly urgent / important. Let me know if I'm missing something.
https://github.com/llvm/llvm-project/pull/97031
More information about the Mlir-commits
mailing list