[Mlir-commits] [mlir] [mlir] Compute ceildivs consistently for INT_MIN operands (PR #215696)
Hung Kuan Tseng
llvmlistbot at llvm.org
Thu Aug 13 21:06:51 PDT 2026
================
@@ -152,10 +152,18 @@ class AffineApplyExpander
/// single division operation as
///
/// a ceildiv b =
- /// let negative = a <= 0 in
- /// let absolute = negative ? -a : a - 1 in
- /// let quotient = absolute / b in
- /// negative ? -quotient : quotient + 1
+ /// let quotient = a / b in
+ /// a > quotient * b ? quotient + 1 : quotient
----------------
Tim096 wrote:
Trimmed to the invariant: the divisor is positive, so unlike the
`arith.ceildivsi` expansion no sign comparison is needed. The change-history
paragraph and the two cross-references are gone -- you are right that they can
go stale independently of this file, and the PR description is the place for
them.
https://github.com/llvm/llvm-project/pull/215696
More information about the Mlir-commits
mailing list