diff options
author | Krzysztof Drewniak <Krzysztof.Drewniak@amd.com> | 2024-11-15 09:43:05 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-15 11:43:05 -0600 |
commit | f2e42d9324f488ef113b8d2157f52ef1699b95f9 (patch) | |
tree | 352d4e08ba6582e14c28bd6f5fda6dfbf7d26066 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | d82422f69c573d051cf08d6d267b619197aab363 (diff) | |
download | llvm-f2e42d9324f488ef113b8d2157f52ef1699b95f9.zip llvm-f2e42d9324f488ef113b8d2157f52ef1699b95f9.tar.gz llvm-f2e42d9324f488ef113b8d2157f52ef1699b95f9.tar.bz2 |
[mlir][IntRangeInference] Handle ceildivsi(INT_MIN, x > 1) as expected (#116284)
Fixes #115293
While the definition of ceildivsi is integer division, rounding up, most
implementations will use `-(-a / b)` for dividing `a ceildiv b` with `a`
negative and `b` positive.
Mathematically, and for most integers, these two definitions are
equivalent. However, with `a == INT_MIN`, the initial negation is a
noop, which means that, while divinding and rounding up would give a
negative result, `-((- INT_MIN) / b)` is `-(INT_MIN / b)`, which is
positive.
This commit adds a special case to ceilDivSI inference to handle this
case and bring it in line with the operational instead of the
mathematical semantics of ceiling division.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
0 files changed, 0 insertions, 0 deletions