[NFC][mlir][vector] Handle potential static cast assertion. (#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.
This commit is contained in:
Md Asghar Ahmad Shahid 2025-08-19 09:27:20 +05:30 committed by GitHub
parent e1ff432eb6
commit c24c23d9ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)