[mlir][vector] Remove usage of shapecast to remove unit dim
authorThomas Raoux <thomasraoux@google.com>
Fri, 19 Nov 2021 00:09:49 +0000 (16:09 -0800)
committerThomas Raoux <thomasraoux@google.com>
Fri, 19 Nov 2021 18:25:21 +0000 (10:25 -0800)
commit06dbb2856967a5497c6ddfad3d3fdfea20849f7e
treeb9dd59a8503a2e3bce8a599bb3bb631c3e8a135d
parentffdace4892bd1f43121d365c22eb9c3fe79aeb6c
[mlir][vector] Remove usage of shapecast to remove unit dim

Instead of using shape_cast op in the pattern removing leading unit
dimensions we use extract/broadcast ops. This is part of the effort to
restrict ShapeCastOp fuirther in the future and only allow them to
convert to or from 1D vector.

This also adds extra canonicalization to fill the gaps in simplifying
broadcast/extract ops.

Differential Revision: https://reviews.llvm.org/D114205
mlir/lib/Dialect/Vector/VectorOps.cpp
mlir/lib/Dialect/Vector/VectorTransforms.cpp
mlir/test/Dialect/Vector/canonicalize.mlir
mlir/test/Dialect/Vector/vector-dim-one-shape-cast.mlir [deleted file]
mlir/test/Dialect/Vector/vector-transforms.mlir