[mlir][Linalg] Canonicalize tensor_reshape(splat-constant) -> splat-constant.
authorMaheshRavishankar <ravishankarm@google.com>
Tue, 18 Aug 2020 15:16:25 +0000 (08:16 -0700)
committerMaheshRavishankar <ravishankarm@google.com>
Tue, 18 Aug 2020 15:17:09 +0000 (08:17 -0700)
commita65a50540e3b5dd1938a1d14f31b912a311537fb
tree9c922dec298bcb4cad1f4aac3ecc833388107b2a
parent87122c3480e2115951045102bb26eedc200c8473
[mlir][Linalg] Canonicalize tensor_reshape(splat-constant) -> splat-constant.

When the operand to the linalg.tensor_reshape op is a splat constant,
the result can be replaced with a splat constant of the same value but
different type.

Differential Revision: https://reviews.llvm.org/D86117
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
mlir/test/Dialect/Linalg/canonicalize.mlir