summaryrefslogtreecommitdiffstats
path: root/Python/flowgraph.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/flowgraph.c')
-rw-r--r--Python/flowgraph.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/Python/flowgraph.c b/Python/flowgraph.c
index 9fe387c..e89ad39 100644
--- a/Python/flowgraph.c
+++ b/Python/flowgraph.c
@@ -1017,7 +1017,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;
}
}