@@ -38,22 +38,23 @@ possible cost and use the predicate to guard the match.
3838### Root Operation Name (Optional)
3939
4040The name of the root operation that this pattern matches against. If specified,
41- only operations with the given root name will be provided to the ` match ` and
42- ` rewrite ` implementation. If not specified, any operation type may be provided.
43- The root operation name should be provided whenever possible, because it
44- simplifies the analysis of patterns when applying a cost model. To match any
41+ only operations with the given root name will be provided to the
42+ ` matchAndRewrite ` implementation. If not specified, any operation type may be
43+ provided. The root operation name should be provided whenever possible, because
44+ it simplifies the analysis of patterns when applying a cost model. To match any
4545operation type, a special tag must be provided to make the intent explicit:
4646` MatchAnyOpTypeTag ` .
4747
48- ### ` match ` and ` rewrite ` implementation
48+ ### ` matchAndRewrite ` implementation
4949
5050This is the chunk of code that matches a given root ` Operation ` and performs a
5151rewrite of the IR. A ` RewritePattern ` can specify this implementation either via
52- separate ` match ` and ` rewrite ` methods, or via a combined ` matchAndRewrite `
53- method. When using the combined ` matchAndRewrite ` method, no IR mutation should
54- take place before the match is deemed successful. The combined ` matchAndRewrite `
55- is useful when non-trivially recomputable information is required by the
56- matching and rewriting phase. See below for examples:
52+ the ` matchAndRewrite ` method or via separate ` match ` and ` rewrite ` methods when
53+ deriving from ` RewritePattern::SplitMatchAndRewrite ` . When using the combined
54+ ` matchAndRewrite ` method, no IR mutation should take place before the match is
55+ deemed successful. The combined ` matchAndRewrite ` is useful when non-trivially
56+ recomputable information is required by the matching and rewriting phase. See
57+ below for examples:
5758
5859``` c++
5960class MyPattern : public RewritePattern {
@@ -105,6 +106,10 @@ Within the `rewrite` section of a pattern, the following constraints apply:
105106 `eraseOp`) should be used instead.
106107* The root operation is required to either be: updated in-place, replaced, or
107108 erased.
109+ * `matchAndRewrite` must return "success" if and only if the IR was modified.
110+ `match` must return "success" if and only if the IR is going to be modified
111+ during `rewrite`.
112+
108113
109114### Application Recursion
110115
0 commit comments