-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
GH-123044: Give the POP_TOP after a case test a location in the body, not the pattern.
#130627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
fd5d1e7
1ce7f7f
f98fe7a
7084af0
9332b19
0d82f1b
ab6fa4c
1229037
a077433
00380b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Make sure that the location of branch targets in ``match`` cases is in the | ||
| body, not the pattern. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -343,6 +343,15 @@ assemble_location_info(struct assembler *a, instr_sequence *instrs, | |
| a->a_lineno = firstlineno; | ||
| location loc = NO_LOCATION; | ||
| int size = 0; | ||
| if (same_location(instrs->s_instrs[instrs->s_used-1].i_loc, NEXT_LOCATION)) { | ||
| instrs->s_instrs[instrs->s_used-1].i_loc = NO_LOCATION; | ||
| } | ||
| for (int i = instrs->s_used-1; i > 0; i--) { | ||
| instruction *instr = &instrs->s_instrs[i]; | ||
| if (same_location(instr[-1].i_loc, NEXT_LOCATION)) { | ||
| instr[-1].i_loc = instr->i_loc; | ||
| } | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this transformation should be in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't it be too early in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From the next block (fall through or jump). If there is more than one successor, then we have a problem anyway, right, so what do we do? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should only use |
||
| for (int i = 0; i < instrs->s_used; i++) { | ||
| instruction *instr = &instrs->s_instrs[i]; | ||
| if (!same_location(loc, instr->i_loc)) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good idea.
We probably need to change remove_redundant_nops to treat this as no location. Maybe it should be (-2, -2, -2, -2) and then just compare to 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some checks for
NO_LOCATIONthat compare to 0, but it isn't clear to me which should supportNEXT_LOCATIONand which shouldn't, so I'm a bit reluctant to do that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With {2, -2, -2, -2},
basicblock_remove_redundant_nopsandpropagate_line_numbersneeded changing.basicblock_remove_redundant_nopsneeds to treat NEXT_LOCATION like NO_LOCATIONpropagate_line_numbersneeds to treat NEXT_LOCATION not like NO_LOCATION