Skip to content

Commit d28d2f9

Browse files
committed
address comments
1 parent 3f23b4d commit d28d2f9

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

mlir/docs/Canonicalization.md

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -276,23 +276,7 @@ Operation *MyDialect::materializeConstant(OpBuilder &builder, Attribute value,
276276
}
277277
```
278278
279-
### Choosing between implementing a Folder or a `RewritePattern`
280-
281-
When implementing a new canonicalization, an important thing to think about is
282-
if the canonicalization should be a folder or a `RewritePattern`. The generally
283-
accepted policy is:
284-
285-
* If a transformation should be a canonicalizer is a different question from
286-
if a transformation should be a folder or a `RewritePattern`. A
287-
transformation is promoted to a canonicalization as defined by the General
288-
Design of canonicalizations.
289-
290-
* If a transformation is a canonicalization, there are two ways to implement
291-
it: As a Folder or as a `RewritePattern`, both of which are implementation
292-
details of how a canonicalization exists, with the difference being folders
293-
have restrictions on what they can do. A `RewritePattern` can implement any
294-
transformation a folder can.
295-
296-
* A canonicalization should always be implemented as a Folder if it fits
297-
the "local" definition of a folder, otherwise it should be implemented
298-
as a `RewritePattern`.
279+
### When to use the `fold` method vs `RewriterPattern`s for canonicalizations
280+
281+
A canonicalization should always be implemented as a `fold` method if it can
282+
be, otherwise it should be implemented as a `RewritePattern`.

0 commit comments

Comments
 (0)