[MLIR][STD] Fold trunci (zexti).
authorKareemErgawy-TomTom <kareem.ergawy@gmail.com>
Sat, 27 Mar 2021 18:40:10 +0000 (19:40 +0100)
committerKareemErgawy-TomTom <kareem.ergawy@gmail.com>
Sat, 27 Mar 2021 18:40:10 +0000 (19:40 +0100)
commite5f2898bc751aab581193ad87cf887e5c4c8bcec
tree328d5f2791cc62b29337e8c60b91abe0d44401dc
parentab158d35b5a09b2541071ec8351a6ad57dfd7b6e
[MLIR][STD] Fold trunci (zexti).

This patch folds the following pattern:

```
  %arg0 = ...
  %0 = zexti %arg0 : i1 to i8
  %1 = trunci %0 : i8 to i1
```

into just `%arg0`.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D99453
mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
mlir/test/Transforms/canonicalize.mlir