Commit c94d8e3
authored
[mypyc] Provide an easier way to define IR-to-IR transforms (#16998)
This makes it easy to define simple IR-to-IR transforms by subclassing
`IRTansform` and overriding some visit methods.
Add an implementation of a simple copy propagation optimization as an
example.
This will be used by the implementation of mypyc/mypyc#854, and this can
also be used for various optimizations.
The IR transform preserves the identities of ops that are not modified.
This means that the old IR is no longer valid after the transform, but
the transform can be fast since we don't need to allocate many objects
if only a small subset of ops will be modified by a transform.1 parent e0ad952 commit c94d8e3
File tree
7 files changed
+904
-17
lines changed- mypyc
- codegen
- irbuild
- test-data
- test
- transform
7 files changed
+904
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| |||
225 | 226 | | |
226 | 227 | | |
227 | 228 | | |
228 | | - | |
229 | 229 | | |
230 | 230 | | |
| 231 | + | |
231 | 232 | | |
232 | | - | |
233 | | - | |
234 | | - | |
| 233 | + | |
235 | 234 | | |
236 | | - | |
237 | | - | |
238 | | - | |
| 235 | + | |
239 | 236 | | |
| 237 | + | |
| 238 | + | |
240 | 239 | | |
241 | 240 | | |
242 | 241 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
| 163 | + | |
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| |||
1111 | 1111 | | |
1112 | 1112 | | |
1113 | 1113 | | |
1114 | | - | |
1115 | | - | |
1116 | | - | |
| 1114 | + | |
1117 | 1115 | | |
1118 | 1116 | | |
1119 | 1117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
130 | 129 | | |
131 | 130 | | |
132 | 131 | | |
| |||
220 | 219 | | |
221 | 220 | | |
222 | 221 | | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
| 222 | + | |
227 | 223 | | |
228 | | - | |
229 | 224 | | |
230 | 225 | | |
231 | 226 | | |
| |||
2394 | 2389 | | |
2395 | 2390 | | |
2396 | 2391 | | |
| 2392 | + | |
2397 | 2393 | | |
2398 | 2394 | | |
2399 | 2395 | | |
| |||
0 commit comments