diff --git a/mlir/include/mlir/IR/PatternMatch.h b/mlir/include/mlir/IR/PatternMatch.h --- a/mlir/include/mlir/IR/PatternMatch.h +++ b/mlir/include/mlir/IR/PatternMatch.h @@ -201,6 +201,15 @@ OpRewritePattern(MLIRContext *context, PatternBenefit benefit = 1) : RewritePattern(SourceOp::getOperationName(), benefit, context) {} + /// Patterns must specify the root operation name they match against, and can + /// also specify the benefit of the pattern matching. + /// `generatedNames` contains the names of operations that may be generated + /// during a successful rewrite. + OpRewritePattern(MLIRContext *context, ArrayRef generatedNames, + PatternBenefit benefit = 1) + : RewritePattern(SourceOp::getOperationName(), generatedNames, benefit, + context) {} + /// Wrappers around the RewritePattern methods that pass the derived op type. void rewrite(Operation *op, PatternRewriter &rewriter) const final { rewrite(cast(op), rewriter);