diff --git a/mlir/lib/Dialect/Vector/VectorTransforms.cpp b/mlir/lib/Dialect/Vector/VectorTransforms.cpp --- a/mlir/lib/Dialect/Vector/VectorTransforms.cpp +++ b/mlir/lib/Dialect/Vector/VectorTransforms.cpp @@ -2970,6 +2970,9 @@ return failure(); SmallVector newShape = llvm::to_vector<4>( originalVecType.getShape().take_back(reducedShapeRank)); + // Vector rank cannot be zero. Handled by TransferReadToVectorLoadLowering. + if (newShape.empty()) + return failure(); VectorType newReadType = VectorType::get(newShape, originalVecType.getElementType()); ArrayAttr newInBounds =