@@ -12,7 +12,7 @@ Most compilers have canonicalization passes, and sometimes they have many
12
12
different ones (e.g. instcombine, dag combine, etc in LLVM). Because MLIR is a
13
13
multi-level IR, we can provide a single canonicalization infrastructure and
14
14
reuse it across many different IRs that it represents. This document describes
15
- the general approach, global canonicalization performed, and provides sections
15
+ the general approach, global canonicalizations performed, and provides sections
16
16
to capture IR-specific rules for reference.
17
17
18
18
[ TOC]
@@ -28,7 +28,7 @@ exhausted. This is for efficiency reasons and to ensure that faulty patterns
28
28
cannot cause infinite looping.
29
29
30
30
Canonicalization patterns are registered with the operations themselves, which
31
- allows each dialect to define its own set of operations and canonicalization
31
+ allows each dialect to define its own set of operations and canonicalizations
32
32
together.
33
33
34
34
Some important things to think about w.r.t. canonicalization patterns:
@@ -107,15 +107,15 @@ These transformations are applied to all levels of IR:
107
107
108
108
## Defining Canonicalizations
109
109
110
- Two mechanisms are available with which to define canonicalization ;
110
+ Two mechanisms are available with which to define canonicalizations ;
111
111
general ` RewritePattern ` s and the ` fold ` method.
112
112
113
113
### Canonicalizing with ` RewritePattern ` s
114
114
115
- This mechanism allows for providing canonicalization as a set of
115
+ This mechanism allows for providing canonicalizations as a set of
116
116
` RewritePattern ` s, either imperatively defined in C++ or declaratively as
117
117
[ Declarative Rewrite Rules] ( DeclarativeRewrites.md ) . The pattern rewrite
118
- infrastructure allows for expressing many different types of canonicalization .
118
+ infrastructure allows for expressing many different types of canonicalizations .
119
119
These transformations may be as simple as replacing a multiplication with a
120
120
shift, or even replacing a conditional branch with an unconditional one.
121
121
@@ -156,7 +156,7 @@ defining operation rewrites.
156
156
### Canonicalizing with the `fold` method
157
157
158
158
The `fold` mechanism is an intentionally limited, but powerful mechanism that
159
- allows for applying canonicalization in many places throughout the compiler.
159
+ allows for applying canonicalizations in many places throughout the compiler.
160
160
For example, outside of the canonicalizer pass, `fold` is used within the
161
161
[dialect conversion infrastructure](DialectConversion.md) as a legalization
162
162
mechanism, and can be invoked directly anywhere with an `OpBuilder` via
0 commit comments