Skip to content

Commit a7dbe98

Browse files
committed
inline noping out
1 parent e8e70e0 commit a7dbe98

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Python/flowgraph.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,21 +1532,24 @@ fold_constant_intrinsic_list_to_tuple(basicblock *bb, int i,
15321532
return ERROR;
15331533
}
15341534

1535-
int nops = consts_found * 2 + 1;
1536-
for (pos = i - 1; pos >= 0 && consts_found > 0; pos--) {
1537-
instr = &bb->b_instr[pos];
1535+
for (int newpos = i - 1; newpos >= pos; newpos--) {
1536+
instr = &bb->b_instr[newpos];
1537+
if (instr->i_opcode == NOP) {
1538+
continue;
1539+
}
15381540
if (loads_const(instr->i_opcode)) {
15391541
PyObject *constant = get_const_value(instr->i_opcode, instr->i_oparg, consts);
15401542
if (constant == NULL) {
15411543
Py_DECREF(newconst);
15421544
return ERROR;
15431545
}
1546+
assert(consts_found > 0);
15441547
PyTuple_SET_ITEM(newconst, --consts_found, constant);
15451548
}
1549+
INSTR_SET_OP0(instr, NOP);
1550+
INSTR_SET_LOC(instr, NO_LOCATION);
15461551
}
1547-
15481552
assert(consts_found == 0);
1549-
nop_out(bb, i-1, nops);
15501553
return instr_make_load_const(intrinsic, newconst, consts, const_cache);
15511554
}
15521555

0 commit comments

Comments
 (0)