aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib
diff options
context:
space:
mode:
authorBalaji V. Iyer <43187390+bviyer@users.noreply.github.com>2024-03-25 16:05:09 -0500
committerGitHub <noreply@github.com>2024-03-25 16:05:09 -0500
commit5f1f9cfaa42a8dee59c9f3a354f973fd8cb003d7 (patch)
tree877bd384ae132d9777ad6129f1c9451c8ec3038d /mlir/lib
parent0a4299403e66871f88518f7399d511b72c634c1d (diff)
downloadllvm-5f1f9cfaa42a8dee59c9f3a354f973fd8cb003d7.zip
llvm-5f1f9cfaa42a8dee59c9f3a354f973fd8cb003d7.tar.gz
llvm-5f1f9cfaa42a8dee59c9f3a354f973fd8cb003d7.tar.bz2
[mlir][Vector] Fix an assertion on failing cast in vector-transfer-flatten-patterns (#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.
Diffstat (limited to 'mlir/lib')
-rw-r--r--mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp
index 7ca0353..38536de 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();