[mypyc] Try adjusting error kinds for all blocks #15262
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
adjust_error_kinds()
should be run over every block, but the old impl. ofinsert_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 ofadjust_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).
Notable removals in the diff (other than the all of the label renumbering) ...1
Footnotes
apologies for the screenshots, this diff was generated during a SSH session so copying and pasting is a real pain. ↩