Skip to content

Commit c258d5f

Browse files
committed
inline noping out
1 parent 0c6d4ce commit c258d5f

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
@@ -1502,21 +1502,24 @@ fold_constant_intrinsic_list_to_tuple(basicblock *bb, int i,
15021502
return ERROR;
15031503
}
15041504

1505-
int nops = consts_found * 2 + 1;
1506-
for (pos = i - 1; pos >= 0 && consts_found > 0; pos--) {
1507-
instr = &bb->b_instr[pos];
1505+
for (int newpos = i - 1; newpos >= pos; newpos--) {
1506+
instr = &bb->b_instr[newpos];
1507+
if (instr->i_opcode == NOP) {
1508+
continue;
1509+
}
15081510
if (loads_const(instr->i_opcode)) {
15091511
PyObject *constant = get_const_value(instr->i_opcode, instr->i_oparg, consts);
15101512
if (constant == NULL) {
15111513
Py_DECREF(newconst);
15121514
return ERROR;
15131515
}
1516+
assert(consts_found > 0);
15141517
PyTuple_SET_ITEM(newconst, --consts_found, constant);
15151518
}
1519+
INSTR_SET_OP0(instr, NOP);
1520+
INSTR_SET_LOC(instr, NO_LOCATION);
15161521
}
1517-
15181522
assert(consts_found == 0);
1519-
nop_out(bb, i-1, nops);
15201523
return instr_make_load_const(intrinsic, newconst, consts, const_cache);
15211524
}
15221525

0 commit comments

Comments
 (0)