[all-commits] [llvm/llvm-project] bd5149: [mlir][CSE] Add ability to remove commutative oper...

Valentin Clement (バレンタイン クレメン) via All-commits all-commits at lists.llvm.org
Sat Apr 16 12:10:09 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bd514967aa221bef5d1adaec12abc68511f325f0
      https://github.com/llvm/llvm-project/commit/bd514967aa221bef5d1adaec12abc68511f325f0
  Author: Valentin Clement <clementval at gmail.com>
  Date:   2022-04-16 (Sat, 16 Apr 2022)

  Changed paths:
    M mlir/lib/IR/OperationSupport.cpp
    M mlir/test/Transforms/cse.mlir

  Log Message:
  -----------
  [mlir][CSE] Add ability to remove commutative operations

This patch takes advantage of the Commutative trait on operation
to remove identical commutative operations where the operands are swapped.

The second operation below can be removed since `arith.addi` is commutative.
```
%1 = arith.addi %a, %b : i32
%2 = arith.addi %b, %a : i32
```

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D123492




More information about the All-commits mailing list