@@ -466,7 +466,13 @@ int zend_dfa_optimize_calls(zend_op_array *op_array, zend_ssa *ssa)
466
466
int var_num = ssa_op -> op1_use ;
467
467
zend_ssa_var * var = ssa -> vars + var_num ;
468
468
469
- ZEND_ASSERT (ssa_op -> op1_def < 0 );
469
+ /* TODO: move to somewhere common */
470
+ int op1_new = ssa_op -> op1_use ;
471
+ /* zend_ssa_rename_var_uses() clear use_chain & phi_use_chain for us */
472
+ zend_ssa_rename_var_uses (ssa , ssa_op -> op1_def , op1_new , true);
473
+ ssa -> vars [ssa_op -> op1_def ].definition = -1 ;
474
+ ssa_op -> op1_def = -1 ;
475
+ //ZEND_ASSERT(ssa_op->op1_def < 0);
470
476
zend_ssa_unlink_use_chain (ssa , op_num , ssa_op -> op1_use );
471
477
ssa_op -> op1_use = -1 ;
472
478
ssa_op -> op1_use_chain = -1 ;
@@ -1080,12 +1086,13 @@ static void zend_dfa_optimize_send_copies(zend_op_array *op_array, zend_ssa *ssa
1080
1086
continue ;
1081
1087
}
1082
1088
1083
- int op1_def = ssa -> ops [i ].op1_def ;
1089
+ zend_ssa_op * this_ssa_op = ssa -> ops + i ;
1090
+ int op1_def = this_ssa_op -> op1_def ;
1084
1091
if (op1_def == -1 ) {
1085
1092
continue ;
1086
1093
}
1087
1094
1088
- int ssa_cv = ssa -> ops [ i ]. op1_use ;
1095
+ int ssa_cv = this_ssa_op -> op1_use ;
1089
1096
1090
1097
#if 0
1091
1098
/* Argument move must not be observable in backtraces */
@@ -1105,10 +1112,17 @@ static void zend_dfa_optimize_send_copies(zend_op_array *op_array, zend_ssa *ssa
1105
1112
1106
1113
/* If the variable's value does not matter, it does not alias, but it is used;
1107
1114
* then it means its use will override the value and we can perform the implicit move optimization. */
1108
- if (ssa_var -> no_val && !ssa_var -> alias && ssa_var -> use_chain >= 0 ) {
1115
+ if (ssa_var -> no_val && !ssa_var -> alias /* && ssa_var->use_chain >= 0*/ ) {
1109
1116
/* Flag will be used by VM type spec handler */
1110
1117
op_array -> opcodes [i ].extended_value = 1 ;
1111
1118
//fprintf(stderr, "optimized\n");
1119
+ } else {
1120
+ /* TODO: move to somewhere common */
1121
+ int op1_new = this_ssa_op -> op1_use ;
1122
+ /* zend_ssa_rename_var_uses() clear use_chain & phi_use_chain for us */
1123
+ zend_ssa_rename_var_uses (ssa , this_ssa_op -> op1_def , op1_new , true);
1124
+ ssa -> vars [this_ssa_op -> op1_def ].definition = -1 ;
1125
+ this_ssa_op -> op1_def = -1 ;
1112
1126
}
1113
1127
}
1114
1128
}
0 commit comments