[mlir][Vector] Disable 'vector.extract' folding for unsupported 0-D vectors
authorDiego Caballero <diegocaballero@google.com>
Thu, 1 Jun 2023 21:44:41 +0000 (21:44 +0000)
committerDiego Caballero <diegocaballero@google.com>
Thu, 1 Jun 2023 22:22:15 +0000 (22:22 +0000)
commit45b25d24f04dba7e3089453774544459f152ef95
treedf83c5888e14f87935af53026f2ebbeba2f9454d
parent10e422dd450269e6148e77c6afe3cbddab1c9f74
[mlir][Vector] Disable 'vector.extract' folding for unsupported 0-D vectors

The `vector.extract` folding patterns do not support 0-D vectors
(actually, 0-D vector support couldn't even be implemented as a folding
pattern as it would require replacing `vector.extract` with a
`vector.extractelement` op). This patch is bailing out folding when 0-D
vectors are found.

Reviewed By: nicolasvasilache, hanchung

Differential Revision: https://reviews.llvm.org/D151847
mlir/lib/Dialect/Vector/IR/VectorOps.cpp
mlir/test/Dialect/Vector/canonicalize.mlir