[Mlir-commits] [mlir] 56ada0f - [mlir][vector] Use dyn_cast instead of cast in patterns
Lei Zhang
llvmlistbot at llvm.org
Mon Nov 8 09:38:07 PST 2021
Author: Lei Zhang
Date: 2021-11-08T12:34:14-05:00
New Revision: 56ada0f80df26a09a0e84a67720efd916633b1f3
URL: https://github.com/llvm/llvm-project/commit/56ada0f80df26a09a0e84a67720efd916633b1f3
DIFF: https://github.com/llvm/llvm-project/commit/56ada0f80df26a09a0e84a67720efd916633b1f3.diff
LOG: [mlir][vector] Use dyn_cast instead of cast in patterns
This avoids crashes when the pattern is applied to ops with
tensor semantics.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D113415
Added:
Modified:
mlir/lib/Dialect/Vector/VectorTransforms.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Vector/VectorTransforms.cpp b/mlir/lib/Dialect/Vector/VectorTransforms.cpp
index 912031035ed7e..6528789810bfa 100644
--- a/mlir/lib/Dialect/Vector/VectorTransforms.cpp
+++ b/mlir/lib/Dialect/Vector/VectorTransforms.cpp
@@ -3579,7 +3579,7 @@ class DropInnerMostUnitDims : public OpRewritePattern<vector::TransferReadOp> {
LogicalResult matchAndRewrite(vector::TransferReadOp readOp,
PatternRewriter &rewriter) const override {
- auto srcType = readOp.source().getType().cast<MemRefType>();
+ auto srcType = readOp.source().getType().dyn_cast<MemRefType>();
if (!srcType || !srcType.hasStaticShape())
return failure();
More information about the Mlir-commits
mailing list