Skip to content

Commit 51e63f2

Browse files
committed
Move some stuff
1 parent 1354b04 commit 51e63f2

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

Zend/Optimizer/dfa_pass.c

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ static void zend_dfa_optimize_send_copies(zend_op_array *op_array, zend_ssa *ssa
10781078
}
10791079

10801080
for (uint32_t i = 0; i < op_array->last; i++) {
1081-
const zend_op *opline = &op_array->opcodes[i];
1081+
zend_op *opline = op_array->opcodes + i;
10821082
if ((opline->opcode != ZEND_SEND_VAR && opline->opcode != ZEND_SEND_VAR_EX) || opline->op2_type != IS_UNUSED || opline->op1_type != IS_CV) {
10831083
continue;
10841084
}
@@ -1105,14 +1105,11 @@ static void zend_dfa_optimize_send_copies(zend_op_array *op_array, zend_ssa *ssa
11051105
continue;
11061106
}
11071107

1108-
zend_ssa_var *ssa_var = &ssa->vars[op1_def];
1108+
zend_ssa_var *ssa_var = ssa->vars + op1_def;
11091109

1110-
/* If the variable's value does not matter, it does not alias, but it is used;
1111-
* then it means its use will override the value and we can perform the implicit move optimization. */
1112-
if (ssa_var->no_val && !ssa_var->alias/* && ssa_var->use_chain >= 0*/) {
1110+
if (ssa_var->no_val && !ssa_var->alias) {
11131111
/* Flag will be used by VM type spec handler */
1114-
op_array->opcodes[i].extended_value = 1;
1115-
//fprintf(stderr, "optimized\n");
1112+
opline->extended_value = 1;
11161113
} else if (opline->opcode == ZEND_SEND_VAR) {
11171114
zend_ssa_replace_op1_def_op1_use(ssa, ssa_op);
11181115
}
@@ -1137,6 +1134,14 @@ void zend_dfa_optimize_op_array(zend_op_array *op_array, zend_optimizer_ctx *ctx
11371134
ssa_verify_integrity(op_array, ssa, "before dfa");
11381135
#endif
11391136

1137+
/* Optimization should not be done on main because of globals. */
1138+
if (op_array->function_name) {
1139+
zend_dfa_optimize_send_copies(op_array, ssa);
1140+
#if ZEND_DEBUG_DFA
1141+
ssa_verify_integrity(op_array, ssa, "after optimize send copies");
1142+
#endif
1143+
}
1144+
11401145
if (ZEND_OPTIMIZER_PASS_8 & ctx->optimization_level) {
11411146
if (sccp_optimize_op_array(ctx, op_array, ssa, call_map)) {
11421147
remove_nops = 1;
@@ -1177,14 +1182,6 @@ void zend_dfa_optimize_op_array(zend_op_array *op_array, zend_optimizer_ctx *ctx
11771182
#endif
11781183
}
11791184

1180-
/* Optimization should not be done on main because of globals. */
1181-
if (op_array->function_name) {
1182-
zend_dfa_optimize_send_copies(op_array, ssa);
1183-
#if ZEND_DEBUG_DFA
1184-
ssa_verify_integrity(op_array, ssa, "after optimize send copies");
1185-
#endif
1186-
}
1187-
11881185
for (v = op_array->last_var; v < ssa->vars_count; v++) {
11891186

11901187
op_1 = ssa->vars[v].definition;

0 commit comments

Comments
 (0)