[mlir][vector] Insert/extract element can accept index
authorMogball <jeffniu22@gmail.com>
Thu, 18 Nov 2021 05:41:25 +0000 (05:41 +0000)
committerMogball <jeffniu22@gmail.com>
Thu, 18 Nov 2021 22:40:29 +0000 (22:40 +0000)
commit7c5ecc8b7e1bcd1b02eafeba9bbf3d5bc50d72c5
treec3f78cf71fa106a5096eea54c00c1d40ae934d95
parent3b7b4a80414579bcf0b6318b8c63f8f5c65bc441
[mlir][vector] Insert/extract element can accept index

`vector::InsertElementOp` and `vector::ExtractElementOp` have had their `position`
operand changed to accept `AnySignlessIntegerOrIndex` for better operability with
operations that use `index`, such as affine loops.

LLVM's `extractelement` and `insertelement` can also accept `i64`, so lowering
directly to these operations without explicitly inserting casts is allowed. SPIRV's
equivalent ops can also accept `i64`.

Reviewed By: nicolasvasilache, jpienaar

Differential Revision: https://reviews.llvm.org/D114139
13 files changed:
mlir/include/mlir/Dialect/Vector/VectorOps.td
mlir/include/mlir/IR/OpBase.td
mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp
mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
mlir/lib/Dialect/Vector/VectorMultiDimReductionTransforms.cpp
mlir/lib/Dialect/Vector/VectorOps.cpp
mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir
mlir/test/Conversion/VectorToSCF/vector-to-scf.mlir
mlir/test/Conversion/VectorToSPIRV/simple.mlir
mlir/test/Dialect/SparseTensor/sparse_vector.mlir
mlir/test/Dialect/SparseTensor/sparse_vector_chain.mlir
mlir/test/Dialect/Vector/vector-multi-reduction-lowering.mlir