@@ -1273,24 +1273,23 @@ void zend_dfa_optimize_op_array(zend_op_array *op_array, zend_optimizer_ctx *ctx
12731273// op_1: VERIFY_RETURN_TYPE #orig_var.? [T] -> #v.? [T] => NOP
12741274
12751275 int orig_var = ssa -> ops [op_1 ].op1_use ;
1276- if ( zend_ssa_unlink_use_chain (ssa , op_1 , orig_var )) {
1276+ zend_ssa_unlink_use_chain (ssa , op_1 , orig_var );
12771277
1278- int ret = ssa -> vars [v ].use_chain ;
1279- if (ret >= 0 ) {
1280- ssa -> ops [ret ].op1_use = orig_var ;
1281- ssa -> ops [ret ].op1_use_chain = ssa -> vars [orig_var ].use_chain ;
1282- ssa -> vars [orig_var ].use_chain = ret ;
1283- }
1278+ int ret = ssa -> vars [v ].use_chain ;
1279+ if (ret >= 0 ) {
1280+ ssa -> ops [ret ].op1_use = orig_var ;
1281+ ssa -> ops [ret ].op1_use_chain = ssa -> vars [orig_var ].use_chain ;
1282+ ssa -> vars [orig_var ].use_chain = ret ;
1283+ }
12841284
1285- ssa -> vars [v ].definition = -1 ;
1286- ssa -> vars [v ].use_chain = -1 ;
1285+ ssa -> vars [v ].definition = -1 ;
1286+ ssa -> vars [v ].use_chain = -1 ;
12871287
1288- ssa -> ops [op_1 ].op1_def = -1 ;
1289- ssa -> ops [op_1 ].op1_use = -1 ;
1288+ ssa -> ops [op_1 ].op1_def = -1 ;
1289+ ssa -> ops [op_1 ].op1_use = -1 ;
12901290
1291- MAKE_NOP (opline );
1292- remove_nops = 1 ;
1293- }
1291+ MAKE_NOP (opline );
1292+ remove_nops = 1 ;
12941293 }
12951294 }
12961295
@@ -1322,7 +1321,8 @@ void zend_dfa_optimize_op_array(zend_op_array *op_array, zend_optimizer_ctx *ctx
13221321// op_2: #src_var.T = OP ... => #v.CV = OP ...
13231322// op_1: QM_ASSIGN #src_var.T #orig_var.CV [undef,scalar] -> #v.CV, NOP
13241323
1325- if (orig_var < 0 || zend_ssa_unlink_use_chain (ssa , op_1 , orig_var )) {
1324+ if (orig_var < 0 ) {
1325+ zend_ssa_unlink_use_chain (ssa , op_1 , orig_var );
13261326 /* Reconstruct SSA */
13271327 ssa -> vars [v ].definition = op_2 ;
13281328 ssa -> ops [op_2 ].result_def = v ;
@@ -1476,80 +1476,79 @@ void zend_dfa_optimize_op_array(zend_op_array *op_array, zend_optimizer_ctx *ctx
14761476// op_2: #src_var.T = OP ... => #v.CV = OP ...
14771477// op_1: ASSIGN #orig_var.CV [undef,scalar] -> #v.CV, #src_var.T NOP
14781478
1479- if ( zend_ssa_unlink_use_chain (ssa , op_1 , orig_var )) {
1480- /* Reconstruct SSA */
1481- ssa -> vars [v ].definition = op_2 ;
1482- ssa -> ops [op_2 ].result_def = v ;
1479+ zend_ssa_unlink_use_chain (ssa , op_1 , orig_var );
1480+ /* Reconstruct SSA */
1481+ ssa -> vars [v ].definition = op_2 ;
1482+ ssa -> ops [op_2 ].result_def = v ;
14831483
1484- ssa -> vars [src_var ].definition = -1 ;
1485- ssa -> vars [src_var ].use_chain = -1 ;
1484+ ssa -> vars [src_var ].definition = -1 ;
1485+ ssa -> vars [src_var ].use_chain = -1 ;
14861486
1487- ssa -> ops [op_1 ].op1_use = -1 ;
1488- ssa -> ops [op_1 ].op2_use = -1 ;
1489- ssa -> ops [op_1 ].op1_def = -1 ;
1490- ssa -> ops [op_1 ].op1_use_chain = -1 ;
1487+ ssa -> ops [op_1 ].op1_use = -1 ;
1488+ ssa -> ops [op_1 ].op2_use = -1 ;
1489+ ssa -> ops [op_1 ].op1_def = -1 ;
1490+ ssa -> ops [op_1 ].op1_use_chain = -1 ;
14911491
1492- /* Update opcodes */
1493- op_array -> opcodes [op_2 ].result_type = opline -> op1_type ;
1494- op_array -> opcodes [op_2 ].result .var = opline -> op1 .var ;
1492+ /* Update opcodes */
1493+ op_array -> opcodes [op_2 ].result_type = opline -> op1_type ;
1494+ op_array -> opcodes [op_2 ].result .var = opline -> op1 .var ;
14951495
1496- MAKE_NOP (opline );
1497- remove_nops = 1 ;
1498-
1499- if (op_array -> opcodes [op_2 ].opcode == ZEND_SUB
1500- && op_array -> opcodes [op_2 ].op1_type == op_array -> opcodes [op_2 ].result_type
1501- && op_array -> opcodes [op_2 ].op1 .var == op_array -> opcodes [op_2 ].result .var
1502- && op_array -> opcodes [op_2 ].op2_type == IS_CONST
1503- && Z_TYPE_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op2 .constant )) == IS_LONG
1504- && Z_LVAL_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op2 .constant )) == 1
1505- && ssa -> ops [op_2 ].op1_use >= 0
1506- && !(ssa -> var_info [ssa -> ops [op_2 ].op1_use ].type & (MAY_BE_FALSE |MAY_BE_TRUE |MAY_BE_STRING |MAY_BE_ARRAY |MAY_BE_OBJECT |MAY_BE_RESOURCE |MAY_BE_REF ))) {
1507-
1508- op_array -> opcodes [op_2 ].opcode = ZEND_PRE_DEC ;
1509- SET_UNUSED (op_array -> opcodes [op_2 ].op2 );
1510- SET_UNUSED (op_array -> opcodes [op_2 ].result );
1511-
1512- ssa -> ops [op_2 ].result_def = -1 ;
1513- ssa -> ops [op_2 ].op1_def = v ;
1514-
1515- } else if (op_array -> opcodes [op_2 ].opcode == ZEND_ADD
1516- && op_array -> opcodes [op_2 ].op1_type == op_array -> opcodes [op_2 ].result_type
1517- && op_array -> opcodes [op_2 ].op1 .var == op_array -> opcodes [op_2 ].result .var
1518- && op_array -> opcodes [op_2 ].op2_type == IS_CONST
1519- && Z_TYPE_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op2 .constant )) == IS_LONG
1520- && Z_LVAL_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op2 .constant )) == 1
1521- && ssa -> ops [op_2 ].op1_use >= 0
1522- && !(ssa -> var_info [ssa -> ops [op_2 ].op1_use ].type & (MAY_BE_FALSE |MAY_BE_TRUE |MAY_BE_STRING |MAY_BE_ARRAY |MAY_BE_OBJECT |MAY_BE_RESOURCE |MAY_BE_REF ))) {
1523-
1524- op_array -> opcodes [op_2 ].opcode = ZEND_PRE_INC ;
1525- SET_UNUSED (op_array -> opcodes [op_2 ].op2 );
1526- SET_UNUSED (op_array -> opcodes [op_2 ].result );
1527-
1528- ssa -> ops [op_2 ].result_def = -1 ;
1529- ssa -> ops [op_2 ].op1_def = v ;
1530-
1531- } else if (op_array -> opcodes [op_2 ].opcode == ZEND_ADD
1532- && op_array -> opcodes [op_2 ].op2_type == op_array -> opcodes [op_2 ].result_type
1533- && op_array -> opcodes [op_2 ].op2 .var == op_array -> opcodes [op_2 ].result .var
1534- && op_array -> opcodes [op_2 ].op1_type == IS_CONST
1535- && Z_TYPE_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op1 .constant )) == IS_LONG
1536- && Z_LVAL_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op1 .constant )) == 1
1537- && ssa -> ops [op_2 ].op2_use >= 0
1538- && !(ssa -> var_info [ssa -> ops [op_2 ].op2_use ].type & (MAY_BE_FALSE |MAY_BE_TRUE |MAY_BE_STRING |MAY_BE_ARRAY |MAY_BE_OBJECT |MAY_BE_RESOURCE |MAY_BE_REF ))) {
1539-
1540- op_array -> opcodes [op_2 ].opcode = ZEND_PRE_INC ;
1541- op_array -> opcodes [op_2 ].op1_type = op_array -> opcodes [op_2 ].op2_type ;
1542- op_array -> opcodes [op_2 ].op1 .var = op_array -> opcodes [op_2 ].op2 .var ;
1543- SET_UNUSED (op_array -> opcodes [op_2 ].op2 );
1544- SET_UNUSED (op_array -> opcodes [op_2 ].result );
1545-
1546- ssa -> ops [op_2 ].result_def = -1 ;
1547- ssa -> ops [op_2 ].op1_def = v ;
1548- ssa -> ops [op_2 ].op1_use = ssa -> ops [op_2 ].op2_use ;
1549- ssa -> ops [op_2 ].op1_use_chain = ssa -> ops [op_2 ].op2_use_chain ;
1550- ssa -> ops [op_2 ].op2_use = -1 ;
1551- ssa -> ops [op_2 ].op2_use_chain = -1 ;
1552- }
1496+ MAKE_NOP (opline );
1497+ remove_nops = 1 ;
1498+
1499+ if (op_array -> opcodes [op_2 ].opcode == ZEND_SUB
1500+ && op_array -> opcodes [op_2 ].op1_type == op_array -> opcodes [op_2 ].result_type
1501+ && op_array -> opcodes [op_2 ].op1 .var == op_array -> opcodes [op_2 ].result .var
1502+ && op_array -> opcodes [op_2 ].op2_type == IS_CONST
1503+ && Z_TYPE_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op2 .constant )) == IS_LONG
1504+ && Z_LVAL_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op2 .constant )) == 1
1505+ && ssa -> ops [op_2 ].op1_use >= 0
1506+ && !(ssa -> var_info [ssa -> ops [op_2 ].op1_use ].type & (MAY_BE_FALSE |MAY_BE_TRUE |MAY_BE_STRING |MAY_BE_ARRAY |MAY_BE_OBJECT |MAY_BE_RESOURCE |MAY_BE_REF ))) {
1507+
1508+ op_array -> opcodes [op_2 ].opcode = ZEND_PRE_DEC ;
1509+ SET_UNUSED (op_array -> opcodes [op_2 ].op2 );
1510+ SET_UNUSED (op_array -> opcodes [op_2 ].result );
1511+
1512+ ssa -> ops [op_2 ].result_def = -1 ;
1513+ ssa -> ops [op_2 ].op1_def = v ;
1514+
1515+ } else if (op_array -> opcodes [op_2 ].opcode == ZEND_ADD
1516+ && op_array -> opcodes [op_2 ].op1_type == op_array -> opcodes [op_2 ].result_type
1517+ && op_array -> opcodes [op_2 ].op1 .var == op_array -> opcodes [op_2 ].result .var
1518+ && op_array -> opcodes [op_2 ].op2_type == IS_CONST
1519+ && Z_TYPE_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op2 .constant )) == IS_LONG
1520+ && Z_LVAL_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op2 .constant )) == 1
1521+ && ssa -> ops [op_2 ].op1_use >= 0
1522+ && !(ssa -> var_info [ssa -> ops [op_2 ].op1_use ].type & (MAY_BE_FALSE |MAY_BE_TRUE |MAY_BE_STRING |MAY_BE_ARRAY |MAY_BE_OBJECT |MAY_BE_RESOURCE |MAY_BE_REF ))) {
1523+
1524+ op_array -> opcodes [op_2 ].opcode = ZEND_PRE_INC ;
1525+ SET_UNUSED (op_array -> opcodes [op_2 ].op2 );
1526+ SET_UNUSED (op_array -> opcodes [op_2 ].result );
1527+
1528+ ssa -> ops [op_2 ].result_def = -1 ;
1529+ ssa -> ops [op_2 ].op1_def = v ;
1530+
1531+ } else if (op_array -> opcodes [op_2 ].opcode == ZEND_ADD
1532+ && op_array -> opcodes [op_2 ].op2_type == op_array -> opcodes [op_2 ].result_type
1533+ && op_array -> opcodes [op_2 ].op2 .var == op_array -> opcodes [op_2 ].result .var
1534+ && op_array -> opcodes [op_2 ].op1_type == IS_CONST
1535+ && Z_TYPE_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op1 .constant )) == IS_LONG
1536+ && Z_LVAL_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op1 .constant )) == 1
1537+ && ssa -> ops [op_2 ].op2_use >= 0
1538+ && !(ssa -> var_info [ssa -> ops [op_2 ].op2_use ].type & (MAY_BE_FALSE |MAY_BE_TRUE |MAY_BE_STRING |MAY_BE_ARRAY |MAY_BE_OBJECT |MAY_BE_RESOURCE |MAY_BE_REF ))) {
1539+
1540+ op_array -> opcodes [op_2 ].opcode = ZEND_PRE_INC ;
1541+ op_array -> opcodes [op_2 ].op1_type = op_array -> opcodes [op_2 ].op2_type ;
1542+ op_array -> opcodes [op_2 ].op1 .var = op_array -> opcodes [op_2 ].op2 .var ;
1543+ SET_UNUSED (op_array -> opcodes [op_2 ].op2 );
1544+ SET_UNUSED (op_array -> opcodes [op_2 ].result );
1545+
1546+ ssa -> ops [op_2 ].result_def = -1 ;
1547+ ssa -> ops [op_2 ].op1_def = v ;
1548+ ssa -> ops [op_2 ].op1_use = ssa -> ops [op_2 ].op2_use ;
1549+ ssa -> ops [op_2 ].op1_use_chain = ssa -> ops [op_2 ].op2_use_chain ;
1550+ ssa -> ops [op_2 ].op2_use = -1 ;
1551+ ssa -> ops [op_2 ].op2_use_chain = -1 ;
15531552 }
15541553 } else if (opline -> op2_type == IS_CONST
15551554 || ((opline -> op2_type & (IS_TMP_VAR |IS_VAR |IS_CV ))
0 commit comments