@@ -1481,24 +1481,27 @@ fold_constant_intrinsic_list_to_tuple(basicblock *bb, int i,
14811481 bool start_found = false;
14821482 bool expect_append = true;
14831483
1484- for (int pos = i - 1 ; pos >= 0 ; pos -- ) {
1484+ for (int pos = i - 1 ; pos >= 0 ; pos -- ) {
14851485 cfg_instr * instr = & bb -> b_instr [pos ];
1486- if (instr -> i_opcode == NOP ) {
1486+ int opcode = instr -> i_opcode ;
1487+ int oparg = instr -> i_oparg ;
1488+
1489+ if (opcode == NOP ) {
14871490 continue ;
14881491 }
14891492
1490- if (instr -> i_opcode == BUILD_LIST && instr -> i_oparg == 0 ) {
1493+ if (opcode == BUILD_LIST && oparg == 0 ) {
14911494 start_found = expect_append ;
14921495 break ;
14931496 }
14941497
14951498 if (expect_append ) {
1496- if (!( instr -> i_opcode == LIST_APPEND && instr -> i_oparg == 1 ) ) {
1499+ if (opcode != LIST_APPEND || oparg != 1 ) {
14971500 break ;
14981501 }
14991502 }
15001503 else {
1501- if (!loads_const (instr -> i_opcode )) {
1504+ if (!loads_const (opcode )) {
15021505 break ;
15031506 }
15041507 consts_found ++ ;
@@ -1517,17 +1520,16 @@ fold_constant_intrinsic_list_to_tuple(basicblock *bb, int i,
15171520 }
15181521
15191522 int nops = consts_found * 2 + 1 ;
1520- for (int pos = i - 1 ; pos >= 0 && consts_found > 0 ; pos -- ) {
1523+ for (int pos = i - 1 ; pos >= 0 && consts_found > 0 ; pos -- ) {
15211524 cfg_instr * instr = & bb -> b_instr [pos ];
1522- if (! loads_const (instr -> i_opcode )) {
1523- continue ;
1524- }
1525- PyObject * constant = get_const_value ( instr -> i_opcode , instr -> i_oparg , consts );
1526- if ( constant == NULL ) {
1527- Py_DECREF ( newconst );
1528- return ERROR ;
1525+ if (loads_const (instr -> i_opcode )) {
1526+ PyObject * constant = get_const_value ( instr -> i_opcode , instr -> i_oparg , consts ) ;
1527+ if ( constant == NULL ) {
1528+ Py_DECREF ( newconst );
1529+ return ERROR ;
1530+ }
1531+ PyTuple_SET_ITEM ( newconst , -- consts_found , constant ) ;
15291532 }
1530- PyTuple_SET_ITEM (newconst , -- consts_found , constant );
15311533 }
15321534
15331535 assert (consts_found == 0 );
0 commit comments