[mlir][tosa] Add some transpose folders
authorLei Zhang <antiagainst@google.com>
Fri, 24 Sep 2021 19:21:11 +0000 (15:21 -0400)
committerLei Zhang <antiagainst@google.com>
Fri, 24 Sep 2021 19:25:14 +0000 (15:25 -0400)
commite325ebb9c70bbdd48866926a42d4c4373b832035
treeb18205f59f7f1a13fa6641520fdbbb0937f2c32a
parent5eb6b8272931473f3b279db5d2c0006993fda21a
[mlir][tosa] Add some transpose folders

* If the input is a constant splat value, we just
  need to reshape it.
* If the input is a general constant with one user,
  we can also constant fold it, without bloating
  the IR.

Reviewed By: rsuderman

Differential Revision: https://reviews.llvm.org/D110439
mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
mlir/test/Dialect/Tosa/canonicalize.mlir