[mlir][vector] Support 0-D vector when eliding single element reduction
authorKai Sasaki <lewuathe@gmail.com>
Wed, 8 Feb 2023 02:51:08 +0000 (11:51 +0900)
committerKai Sasaki <lewuathe@gmail.com>
Wed, 8 Feb 2023 03:01:56 +0000 (12:01 +0900)
commit3941355d8fee763e99c259ecd02f6fe567583296
treece760121b67c32e98ac87a1c76062db79ea51f5b
parent981218e0f88c78fbf83e45abbae65d09b787f2c1
[mlir][vector] Support 0-D vector when eliding single element reduction

ElideSingleElementReduction causes assertion failure when we give 0-D vector. It's possible to fold the case by using vector.extractelement op instead. It's originally reported in https://github.com/llvm/llvm-project/issues/60193.

Reviewed By: dcaballe

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