[Mlir-commits] [mlir] [mlir] Compute ceildivs consistently for INT_MIN operands (PR #215696)
Jakub Kuderski
llvmlistbot at llvm.org
Wed Aug 12 13:03:57 PDT 2026
https://github.com/kuhar commented:
We should update both remaining lowering paths before landing the shared inference change:
- `mlir/lib/Conversion/IndexToSPIRV/IndexToSPIRV.cpp:103` still lowers `index.ceildivs` through negation. With 32-bit indices, `INT_MIN / 7` evaluates to `306783378`, while the rewritten folder produces `-306783378`.
- `mlir/lib/Dialect/Affine/Utils/Utils.cpp:177` still lowers affine `ceildiv` by negating the dividend. For 64-bit `INT_MIN / 7`, range inference now yields `-1317624576693539401`, while the lowered arithmetic evaluates to the positive value.
In both cases, canonicalization or range optimization before lowering can change the program result. Please port the non-negating quotient/remainder correction to these paths and add matching regression coverage.
https://github.com/llvm/llvm-project/pull/215696
More information about the Mlir-commits
mailing list