@@ -1511,24 +1511,27 @@ fold_constant_intrinsic_list_to_tuple(basicblock *bb, int i,
15111511 bool start_found = false;
15121512 bool expect_append = true;
15131513
1514- for (int pos = i- 1; pos >= 0; pos--) {
1514+ for (int pos = i - 1; pos >= 0; pos--) {
15151515 cfg_instr *instr = &bb->b_instr[pos];
1516- if (instr->i_opcode == NOP) {
1516+ int opcode = instr->i_opcode;
1517+ int oparg = instr->i_oparg;
1518+
1519+ if (opcode == NOP) {
15171520 continue;
15181521 }
15191522
1520- if (instr->i_opcode == BUILD_LIST &&instr->i_oparg == 0) {
1523+ if (opcode == BUILD_LIST && oparg == 0) {
15211524 start_found = expect_append;
15221525 break;
15231526 }
15241527
15251528 if (expect_append) {
1526- if (!(instr->i_opcode == LIST_APPEND && instr->i_oparg == 1) ) {
1529+ if (opcode != LIST_APPEND || oparg != 1 ) {
15271530 break;
15281531 }
15291532 }
15301533 else {
1531- if (!loads_const(instr->i_opcode )) {
1534+ if (!loads_const(opcode )) {
15321535 break;
15331536 }
15341537 consts_found++;
@@ -1547,17 +1550,16 @@ fold_constant_intrinsic_list_to_tuple(basicblock *bb, int i,
15471550 }
15481551
15491552 int nops = consts_found * 2 + 1;
1550- for (int pos = i- 1; pos >= 0 && consts_found > 0; pos--) {
1553+ for (int pos = i - 1; pos >= 0 && consts_found > 0; pos--) {
15511554 cfg_instr *instr = &bb->b_instr[pos];
1552- if (! loads_const(instr->i_opcode)) {
1553- continue ;
1554- }
1555- PyObject *constant = get_const_value(instr->i_opcode, instr->i_oparg, consts );
1556- if (constant == NULL) {
1557- Py_DECREF(newconst);
1558- return ERROR ;
1555+ if (loads_const(instr->i_opcode)) {
1556+ PyObject *constant = get_const_value(instr->i_opcode, instr->i_oparg, consts) ;
1557+ if (constant == NULL) {
1558+ Py_DECREF(newconst );
1559+ return ERROR;
1560+ }
1561+ PyTuple_SET_ITEM(newconst, --consts_found, constant) ;
15591562 }
1560- PyTuple_SET_ITEM(newconst, --consts_found, constant);
15611563 }
15621564
15631565 assert(consts_found == 0);
0 commit comments