[Mlir-commits] [mlir] [mlir] Fix signed ceiling division of INT_MIN (PR #235199)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Oct 23 21:15:57 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- mlir/lib/Conversion/IndexToLLVM/IndexToLLVM.cpp mlir/lib/Conversion/IndexToSPIRV/IndexToSPIRV.cpp mlir/lib/Dialect/Index/IR/IndexOps.cpp mlir/lib/Interfaces/Utils/InferIntRangeCommon.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/mlir/lib/Conversion/IndexToLLVM/IndexToLLVM.cpp b/mlir/lib/Conversion/IndexToLLVM/IndexToLLVM.cpp
index b186f6b87..c1fe24a90 100644
--- a/mlir/lib/Conversion/IndexToLLVM/IndexToLLVM.cpp
+++ b/mlir/lib/Conversion/IndexToLLVM/IndexToLLVM.cpp
@@ -26,9 +26,9 @@ namespace {
 //===----------------------------------------------------------------------===//
 
 /// Compute `q = n / m`, then select `q + 1` when `q * m != n` and the
-/// operands have the same sign, or `q` otherwise. Truncation toward zero already
-/// rounds up for opposite-sign operands; same-sign operands need the increment
-/// only when the division is inexact.
+/// operands have the same sign, or `q` otherwise. Truncation toward zero
+/// already rounds up for opposite-sign operands; same-sign operands need the
+/// increment only when the division is inexact.
 ///
 /// This uses one division and avoids negating operands. Negating INT_MIN would
 /// cause signed overflow because -INT_MIN is not representable, even when a
diff --git a/mlir/lib/Conversion/IndexToSPIRV/IndexToSPIRV.cpp b/mlir/lib/Conversion/IndexToSPIRV/IndexToSPIRV.cpp
index a41dc2f3c..97cb81450 100644
--- a/mlir/lib/Conversion/IndexToSPIRV/IndexToSPIRV.cpp
+++ b/mlir/lib/Conversion/IndexToSPIRV/IndexToSPIRV.cpp
@@ -101,9 +101,9 @@ struct ConvertIndexConstantOpPattern final : OpConversionPattern<ConstantOp> {
 //===----------------------------------------------------------------------===//
 
 /// Compute `q = n / m`, then select `q + 1` when `q * m != n` and the
-/// operands have the same sign, or `q` otherwise. Truncation toward zero already
-/// rounds up for opposite-sign operands; same-sign operands need the increment
-/// only when the division is inexact.
+/// operands have the same sign, or `q` otherwise. Truncation toward zero
+/// already rounds up for opposite-sign operands; same-sign operands need the
+/// increment only when the division is inexact.
 ///
 /// This uses one division and avoids negating operands. Negating INT_MIN would
 /// cause signed overflow because -INT_MIN is not representable, even when a

``````````

</details>


https://github.com/llvm/llvm-project/pull/235199


More information about the Mlir-commits mailing list