[Mlir-commits] [mlir] [NFC][mlir][vector] Handle potential static cast assertion. (PR #152957)
Md Asghar Ahmad Shahid
llvmlistbot at llvm.org
Sun Aug 10 23:22:29 PDT 2025
https://github.com/shahidact created https://github.com/llvm/llvm-project/pull/152957
In FoldArithToVectorOuterProduct pattern, static cast to vector type causes assertion when a scalar type was encountered. It seems the author meant to have a dyn_cast instead.
This NFC patch handles it by using dyn_cast.
>From f40f410cd8540b68eec51f4862b489f49489ceec Mon Sep 17 00:00:00 2001
From: mshahid <md.asghar.ahmad.shahid at intel.com>
Date: Sun, 10 Aug 2025 23:17:25 -0700
Subject: [PATCH] [NFC][mlir][vector] Handle potential static cast assertion.
In FoldArithToVectorOuterProduct pattern, static cast to
vector type causes assertion when a scalar type was encountered.
It seems the author meant to have a dyn_cast instead.
This NFC patch handles it by using dyn_cast.
---
mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
index 2269a40ec8ef1..023c4da7dffdf 100644
--- a/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
@@ -2274,7 +2274,7 @@ struct FoldArithToVectorOuterProduct : public OpRewritePattern<MulOpType> {
LogicalResult matchAndRewrite(MulOpType mulOp,
PatternRewriter &rewriter) const override {
- auto resType = llvm::cast<VectorType>(mulOp.getResult().getType());
+ auto resType = llvm::dyn_cast<VectorType>(mulOp.getResult().getType());
if (!resType)
return failure();
if (resType.getRank() != 2)
More information about the Mlir-commits
mailing list