Skip to content

Commit 0c6d4ce

Browse files
committed
get rid of label
1 parent 20db994 commit 0c6d4ce

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

Python/flowgraph.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,9 +1492,32 @@ fold_constant_intrinsic_list_to_tuple(basicblock *bb, int i,
14921492

14931493
if (opcode == BUILD_LIST && oparg == 0) {
14941494
if (!expect_append) {
1495+
/* Not a sequence start. */
14951496
return SUCCESS;
14961497
}
1497-
goto start_found;
1498+
1499+
/* Sequence start, we are done. */
1500+
PyObject *newconst = PyTuple_New((Py_ssize_t)consts_found);
1501+
if (newconst == NULL) {
1502+
return ERROR;
1503+
}
1504+
1505+
int nops = consts_found * 2 + 1;
1506+
for (pos = i - 1; pos >= 0 && consts_found > 0; pos--) {
1507+
instr = &bb->b_instr[pos];
1508+
if (loads_const(instr->i_opcode)) {
1509+
PyObject *constant = get_const_value(instr->i_opcode, instr->i_oparg, consts);
1510+
if (constant == NULL) {
1511+
Py_DECREF(newconst);
1512+
return ERROR;
1513+
}
1514+
PyTuple_SET_ITEM(newconst, --consts_found, constant);
1515+
}
1516+
}
1517+
1518+
assert(consts_found == 0);
1519+
nop_out(bb, i-1, nops);
1520+
return instr_make_load_const(intrinsic, newconst, consts, const_cache);
14981521
}
14991522

15001523
if (expect_append) {
@@ -1514,29 +1537,6 @@ fold_constant_intrinsic_list_to_tuple(basicblock *bb, int i,
15141537

15151538
/* Did not find sequence start. */
15161539
return SUCCESS;
1517-
1518-
start_found:;
1519-
PyObject *newconst = PyTuple_New((Py_ssize_t)consts_found);
1520-
if (newconst == NULL) {
1521-
return ERROR;
1522-
}
1523-
1524-
int nops = consts_found * 2 + 1;
1525-
for (int pos = i - 1; pos >= 0 && consts_found > 0; pos--) {
1526-
cfg_instr *instr = &bb->b_instr[pos];
1527-
if (loads_const(instr->i_opcode)) {
1528-
PyObject *constant = get_const_value(instr->i_opcode, instr->i_oparg, consts);
1529-
if (constant == NULL) {
1530-
Py_DECREF(newconst);
1531-
return ERROR;
1532-
}
1533-
PyTuple_SET_ITEM(newconst, --consts_found, constant);
1534-
}
1535-
}
1536-
1537-
assert(consts_found == 0);
1538-
nop_out(bb, i-1, nops);
1539-
return instr_make_load_const(intrinsic, newconst, consts, const_cache);
15401540
}
15411541

15421542
#define MIN_CONST_SEQUENCE_SIZE 3

0 commit comments

Comments
 (0)