Commit ac6dc18
authored
[mypyc] Try adjusting error kinds for all blocks (#15262)
`adjust_error_kinds()` should be run over every block, but the old impl.
of `insert_exception_handling()` would stop iterating over blocks once
it generated a default error handler. This made sense for its original
purpose, but unfortunately limits the effectiveness of
`adjust_error_kinds()`.
Changing `insert_exception_handling()` to loop over every block no
matter what also means we can get rid of the weird GetAttr special
casing in the branch emit logic (stumbling across that is what made me
investigate in the first place!).
This reduces self-compile LOC by 1.1% in my experiments (avoiding error
branches sometimes eliminates register assignments or on-error
decrefs... according to my brief look through the C diff between master
and this patch).
| Revision | Self-compile C LOC |
|--------|--------|
| PR | 2 265 486 (**-1.1%**) |
| Master (905c2cb) | 2 290 748 |
Notable removals in the diff (other than the all of the label
renumbering) ...[^1]


[^1]: apologies for the screenshots, this diff was generated during a
SSH session so copying and pasting is a real pain.1 parent f66199f commit ac6dc18
2 files changed
Lines changed: 4 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | 200 | | |
208 | 201 | | |
209 | 202 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 49 | + | |
| 50 | + | |
53 | 51 | | |
54 | 52 | | |
55 | 53 | | |
56 | 54 | | |
57 | | - | |
| 55 | + | |
58 | 56 | | |
59 | 57 | | |
60 | 58 | | |
| |||
0 commit comments