[all-commits] [llvm/llvm-project] 7ef175: [mlir][arith] Fix canon pattern for large ints in ...

Rik Huijzer via All-commits all-commits at lists.llvm.org
Fri Oct 13 03:35:18 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7ef1754301a88ea0cbcffae53c2027abad3cc357
      https://github.com/llvm/llvm-project/commit/7ef1754301a88ea0cbcffae53c2027abad3cc357
  Author: Rik Huijzer <github at huijzer.xyz>
  Date:   2023-10-13 (Fri, 13 Oct 2023)

  Changed paths:
    M mlir/lib/Dialect/Arith/IR/ArithOps.cpp
    M mlir/test/Dialect/Arith/canonicalize.mlir

  Log Message:
  -----------
  [mlir][arith] Fix canon pattern for large ints in chained arith (#68900)

The logic for chained basic arithmetic operations in the `arith` dialect
was using `getInt()` on `IntegerAttr`. This is a problem for very large
integers. Specifically, in
https://github.com/llvm/llvm-project/issues/64774 the following
assertion failed:

```
Assertion failed: (getSignificantBits() <= 64 && "Too many bits for int64_t"), function getSExtValue, file APInt.h, line 1510.
```

According to a comment on `getInt()`, calls to `getInt()` should be
replaced by `getValue()`:

https://github.com/llvm/llvm-project/blob/ab6a66dbec61654d0962f6abf6d6c5b776937584/mlir/include/mlir/IR/BuiltinAttributes.td#L707-L708

This patch fixes https://github.com/llvm/llvm-project/issues/64774 by
doing such a replacement.

---------

Co-authored-by: Markus Böck <markus.boeck02 at gmail.com>




More information about the All-commits mailing list