[all-commits] [llvm/llvm-project] a7262d: [mlir][arith] Add overflow flags support to arith ...

Ivan Butygin via All-commits all-commits at lists.llvm.org
Tue Jan 9 14:17:49 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a7262d2d9bee9bdfdbcd03ca27a0128c2e2b1c1a
      https://github.com/llvm/llvm-project/commit/a7262d2d9bee9bdfdbcd03ca27a0128c2e2b1c1a
  Author: Ivan Butygin <ivan.butygin at gmail.com>
  Date:   2024-01-10 (Wed, 10 Jan 2024)

  Changed paths:
    M mlir/include/mlir/Conversion/ArithCommon/AttrToLLVMConverter.h
    M mlir/include/mlir/Dialect/Arith/IR/ArithBase.td
    M mlir/include/mlir/Dialect/Arith/IR/ArithOps.td
    M mlir/include/mlir/Dialect/Arith/IR/ArithOpsInterfaces.td
    M mlir/lib/Conversion/ArithCommon/AttrToLLVMConverter.cpp
    M mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp
    M mlir/lib/Dialect/Arith/IR/ArithCanonicalization.td
    M mlir/lib/Dialect/Arith/IR/ArithOps.cpp
    M mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir
    M mlir/test/Dialect/Arith/ops.mlir
    M mlir/test/python/ir/diagnostic_handler.py

  Log Message:
  -----------
  [mlir][arith] Add overflow flags support to arith ops (#77211)

Add overflow flags support to the following ops:
* `arith.addi`
* `arith.subi`
* `arith.muli`

Example of new syntax:
```
%res = arith.addi %arg1, %arg2 overflow<nsw> : i64
```
Similar to existing LLVM dialect syntax
```
%res = llvm.add %arg1, %arg2 overflow<nsw> : i64
``` 

Tablegen canonicalization patterns updated to always drop flags, proper
support with tests will be added later.

Updated LLVMIR translation as part of this commit as it currenly written
in a way that it will crash when new attributes added to arith ops
otherwise.

Discussion
https://discourse.llvm.org/t/rfc-integer-overflow-flags-support-in-arith-dialect/76025

---------

Co-authored-by: Yi Wu <yi.wu2 at arm.com>




More information about the All-commits mailing list