[Mlir-commits] [mlir] [mlir][arith] Fix overflow bug in arith::CeilDivSIOp::fold (PR #90947)

Kai Sasaki llvmlistbot at llvm.org
Fri May 3 04:03:00 PDT 2024


================
@@ -701,22 +701,34 @@ OpFoldResult arith::CeilDivSIOp::fold(FoldAdaptor adaptor) {
           // Both positive, return ceil(a, b).
           return signedCeilNonnegInputs(a, b, overflowOrDiv0);
         }
+
+        bool overflowNegA = false;
----------------
Lewuathe wrote:

We may want some comments explaining the motivation of these four flags.

```suggestion
        // No folding happens if any of the intermediate arithmetic operations overflows.
        bool overflowNegA = false;
```

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


More information about the Mlir-commits mailing list