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 @@ -3579,7 +3579,7 @@ LogicalResult matchAndRewrite(vector::TransferReadOp readOp, PatternRewriter &rewriter) const override { - auto srcType = readOp.source().getType().cast(); + auto srcType = readOp.source().getType().dyn_cast(); if (!srcType || !srcType.hasStaticShape()) return failure();