mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
[3.12] gh-109889: fix compiler's redundant NOP detection to look past NOPs with no lineno when looking for the next instruction's lineno (GH-109987) (#110048)
gh-109889: fix compiler's redundant NOP detection to look past NOPs with no lineno when looking for the next instruction's lineno (GH-109987)
(cherry picked from commit f580edcc6a
)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
This commit is contained in:
parent
c794103417
commit
2b96102f29
3 changed files with 18 additions and 1 deletions
|
@ -981,7 +981,17 @@ remove_redundant_nops(basicblock *bb) {
|
|||
}
|
||||
/* or if last instruction in BB and next BB has same line number */
|
||||
if (next) {
|
||||
if (lineno == next->b_instr[0].i_loc.lineno) {
|
||||
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 */
|
||||
continue;
|
||||
}
|
||||
next_loc = instr->i_loc;
|
||||
break;
|
||||
}
|
||||
if (lineno == next_loc.lineno) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue