aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib/Conversion/VectorToLLVM
diff options
context:
space:
mode:
authorMichal Terepeta <michalt@google.com>2021-12-03 08:55:52 +0000
committerNicolas Vasilache <nicolas.vasilache@gmail.com>2021-12-03 08:55:59 +0000
commit1423e8bf5dda75877c0414dd26d024fd770d71fb (patch)
tree30256510c630df45103a244be1985b1aae3075ea /mlir/lib/Conversion/VectorToLLVM
parent8e2b3733967296a838ea9861e362fb4d322d165e (diff)
[mlir][Vector] Support 0-D vectors in `BitCastOp`
The implementation only allows to bit-cast between two 0-D vectors. We could probably support casting from/to vectors like `vector<1xf32>`, but I wasn't convinced that this would be important and it would require breaking the invariant that `BitCastOp` works only on vectors with equal rank. Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D114854
Diffstat (limited to 'mlir/lib/Conversion/VectorToLLVM')
-rw-r--r--mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
index bc42922a4485..9b4dce458b7a 100644
--- a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
+++ b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
@@ -121,9 +121,9 @@ public:
LogicalResult
matchAndRewrite(vector::BitCastOp bitCastOp, OpAdaptor adaptor,
ConversionPatternRewriter &rewriter) const override {
- // Only 1-D vectors can be lowered to LLVM.
- VectorType resultTy = bitCastOp.getType();
- if (resultTy.getRank() != 1)
+ // Only 0-D and 1-D vectors can be lowered to LLVM.
+ VectorType resultTy = bitCastOp.getResultVectorType();
+ if (resultTy.getRank() > 1)
return failure();
Type newResultTy = typeConverter->convertType(resultTy);
rewriter.replaceOpWithNewOp<LLVM::BitcastOp>(bitCastOp, newResultTy,