Skip to content

Commit c24c23d

Browse files
authored
[NFC][mlir][vector] Handle potential static cast assertion. (llvm#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.
1 parent e1ff432 commit c24c23d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2274,7 +2274,7 @@ struct FoldArithToVectorOuterProduct : public OpRewritePattern<MulOpType> {
22742274

22752275
LogicalResult matchAndRewrite(MulOpType mulOp,
22762276
PatternRewriter &rewriter) const override {
2277-
auto resType = llvm::cast<VectorType>(mulOp.getResult().getType());
2277+
auto resType = llvm::dyn_cast<VectorType>(mulOp.getResult().getType());
22782278
if (!resType)
22792279
return failure();
22802280
if (resType.getRank() != 2)

0 commit comments

Comments
 (0)