[mlir][Tensor] Fix ExtractSliceFromReshape transform edge case
authorChristopher Bate <cbate@nvidia.com>
Fri, 16 Sep 2022 22:11:46 +0000 (16:11 -0600)
committerChristopher Bate <cbate@nvidia.com>
Mon, 19 Sep 2022 20:02:45 +0000 (14:02 -0600)
commit4d27f06f9454a6733c3f801c8b992193702607b3
tree18a2afd34be062e81a3c51449a9001ac76010275
parente601e2524458dbe53a4fe5e64e3f1723e3a9ec25
[mlir][Tensor] Fix ExtractSliceFromReshape transform edge case

The transformation would fail if none of the sliced dimensions were
linearized by the producing `tensor.collapse_shape`. This is a trivial
edge case but it wasn't correctly tested. Fixes the issue and adds a test.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D134088
mlir/include/mlir/Dialect/Utils/ReshapeOpsUtils.h
mlir/lib/Dialect/Tensor/Transforms/ExtractSliceFromReshape.cpp
mlir/lib/Dialect/Utils/ReshapeOpsUtils.cpp
mlir/test/Dialect/Tensor/extract-slice-from-collapse-shape.mlir
mlir/test/lib/Dialect/Tensor/TestTensorTransforms.cpp