GH-123044: Give the POP_TOP after a case test a location in the body, not the pattern. (GH-130627)

This commit is contained in:
Mark Shannon 2025-03-10 17:31:16 +00:00 committed by GitHub
parent 91d6db7ee0
commit be046ee6e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 52 additions and 6 deletions

View file

@ -1078,8 +1078,8 @@ basicblock_remove_redundant_nops(basicblock *bb) {
location next_loc = NO_LOCATION;
for (int next_i=0; next_i < next->b_iused; next_i++) {
cfg_instr *instr = &next->b_instr[next_i];
if (instr->i_opcode == NOP && instr->i_loc.lineno == NO_LOCATION.lineno) {
/* Skip over NOPs without location, they will be removed */
if (instr->i_opcode == NOP && instr->i_loc.lineno < 0) {
/* Skip over NOPs without a location, they will be removed */
continue;
}
next_loc = instr->i_loc;
@ -2976,7 +2976,7 @@ propagate_line_numbers(basicblock *entryblock) {
location prev_location = NO_LOCATION;
for (int i = 0; i < b->b_iused; i++) {
if (b->b_instr[i].i_loc.lineno < 0) {
if (b->b_instr[i].i_loc.lineno == NO_LOCATION.lineno) {
b->b_instr[i].i_loc = prev_location;
}
else {
@ -2985,7 +2985,7 @@ propagate_line_numbers(basicblock *entryblock) {
}
if (BB_HAS_FALLTHROUGH(b) && b->b_next->b_predecessors == 1) {
if (b->b_next->b_iused > 0) {
if (b->b_next->b_instr[0].i_loc.lineno < 0) {
if (b->b_next->b_instr[0].i_loc.lineno == NO_LOCATION.lineno) {
b->b_next->b_instr[0].i_loc = prev_location;
}
}
@ -2993,7 +2993,7 @@ propagate_line_numbers(basicblock *entryblock) {
if (is_jump(last)) {
basicblock *target = last->i_target;
if (target->b_predecessors == 1) {
if (target->b_instr[0].i_loc.lineno < 0) {
if (target->b_instr[0].i_loc.lineno == NO_LOCATION.lineno) {
target->b_instr[0].i_loc = prev_location;
}
}