diff --git a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp index a97d0cd7f755b..c4d49334602db 100644 --- a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp +++ b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp @@ -6087,6 +6087,9 @@ class ScatterFolder final : public OpRewritePattern { using Base::Base; LogicalResult matchAndRewrite(ScatterOp scatter, PatternRewriter &rewriter) const override { + if (!isa(scatter.getBase().getType())) + return failure(); + switch (getMaskFormat(scatter.getMask())) { case MaskFormat::AllTrue: return failure(); // no unmasked equivalent @@ -6107,6 +6110,9 @@ class FoldContiguousScatter final : public OpRewritePattern { using Base::Base; LogicalResult matchAndRewrite(ScatterOp op, PatternRewriter &rewriter) const override { + if (!isa(op.getBase().getType())) + return failure(); + if (failed(isZeroBasedContiguousSeq(op.getIndices()))) return failure();