[Mlir-commits] [mlir] Added a dynamic check for VectorType. (PR #86030)
Balaji V. Iyer.
llvmlistbot at llvm.org
Wed Mar 20 15:51:10 PDT 2024
https://github.com/bviyer created https://github.com/llvm/llvm-project/pull/86030
When the result is not a vectorType, there is an assert. This patch will do the check
and bail when the result is not a VectorType.
>From afc2639af07bff07d887cfa38dd6eb872762d9cb Mon Sep 17 00:00:00 2001
From: "Balaji V. Iyer" <bviyer at gmail.com>
Date: Wed, 20 Mar 2024 20:05:42 +0000
Subject: [PATCH] Added a dynamic check for VectorType.
When the result is not a vectorType, there is an assert.
This patch will do the check and bail when the result is
not a VectorType.
---
mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp
index 7ca03537049812..38536de43f13f2 100644
--- a/mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp
@@ -22,9 +22,9 @@ using namespace mlir;
static bool isLessThanTargetBitWidth(Operation *op, unsigned targetBitWidth) {
auto resultTypes = op->getResultTypes();
for (auto resType : resultTypes) {
- VectorType vecType = cast<VectorType>(resType);
+ VectorType vecType = dyn_cast<VectorType>(resType);
// Reject index since getElementTypeBitWidth will abort for Index types.
- if (vecType.getElementType().isIndex())
+ if (!vecType || vecType.getElementType().isIndex())
return false;
unsigned trailingVecDimBitWidth =
vecType.getShape().back() * vecType.getElementTypeBitWidth();
More information about the Mlir-commits
mailing list