[MLIR][Shape] Add canonicalization pattern for `shape.rank`
authorFrederik Gossen <frgossen@google.com>
Thu, 25 Jun 2020 08:37:18 +0000 (08:37 +0000)
committerFrederik Gossen <frgossen@google.com>
Thu, 25 Jun 2020 08:39:35 +0000 (08:39 +0000)
commit7bca97d960ab9451185a997208057a89355b406a
tree42dca674847aaac91ddba1e1f74f9b96e76966fc
parent0045786f146e78afee49eee053dc29ebc842fee1
[MLIR][Shape] Add canonicalization pattern for `shape.rank`

Replace any `rank(shape_of(tensor))` that relies on a ranked tensor with the
corresponding constant `const_size`.

Differential Revision: https://reviews.llvm.org/D82077
mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
mlir/lib/Dialect/Shape/IR/Shape.cpp
mlir/test/Dialect/Shape/canonicalize.mlir