Skip to content

Commit afc2639

Browse files
committed
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.
1 parent de0abc0 commit afc2639

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ using namespace mlir;
2222
static bool isLessThanTargetBitWidth(Operation *op, unsigned targetBitWidth) {
2323
auto resultTypes = op->getResultTypes();
2424
for (auto resType : resultTypes) {
25-
VectorType vecType = cast<VectorType>(resType);
25+
VectorType vecType = dyn_cast<VectorType>(resType);
2626
// Reject index since getElementTypeBitWidth will abort for Index types.
27-
if (vecType.getElementType().isIndex())
27+
if (!vecType || vecType.getElementType().isIndex())
2828
return false;
2929
unsigned trailingVecDimBitWidth =
3030
vecType.getShape().back() * vecType.getElementTypeBitWidth();

0 commit comments

Comments
 (0)