[mlir] Change DenseArrayAttr to TensorType
authorJeff Niu <jeff@modular.com>
Mon, 1 Aug 2022 18:20:26 +0000 (14:20 -0400)
committerJeff Niu <jeff@modular.com>
Tue, 2 Aug 2022 02:17:28 +0000 (22:17 -0400)
commitff52ad796c971dbf805375a2140344f742db94a3
treef1a2d76455734846cfcbd90653a620c43b147732
parent7a4902a0ccdb4cd37f8fe4d7a292dd0084cc3741
[mlir] Change DenseArrayAttr to TensorType

Previously, DenseArrayAttr used VectorType for its shaped type.
VectorType is problematic for arrays because it doesn't support zero
dimensions, meaning that an empty array would have `vector<i32>` as its
type. ElementsAttr would think that an empty dense array is size 1, not
0. This patch switches over to TensorType, which does support zero
dimensions.

Fixes #56860

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D130921
mlir/lib/IR/AsmPrinter.cpp
mlir/lib/IR/BuiltinAttributes.cpp