Skip to content

Commit 492d70f

Browse files
committed
Testing
1 parent fdb8bff commit 492d70f

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

Zend/Optimizer/dfa_pass.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,13 @@ int zend_dfa_optimize_calls(zend_op_array *op_array, zend_ssa *ssa)
466466
int var_num = ssa_op->op1_use;
467467
zend_ssa_var *var = ssa->vars + var_num;
468468

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);
470476
zend_ssa_unlink_use_chain(ssa, op_num, ssa_op->op1_use);
471477
ssa_op->op1_use = -1;
472478
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
10801086
continue;
10811087
}
10821088

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;
10841091
if (op1_def == -1) {
10851092
continue;
10861093
}
10871094

1088-
int ssa_cv = ssa->ops[i].op1_use;
1095+
int ssa_cv = this_ssa_op->op1_use;
10891096

10901097
#if 0
10911098
/* 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
11051112

11061113
/* If the variable's value does not matter, it does not alias, but it is used;
11071114
* 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*/) {
11091116
/* Flag will be used by VM type spec handler */
11101117
op_array->opcodes[i].extended_value = 1;
11111118
//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;
11121126
}
11131127
}
11141128
}

Zend/Optimizer/sccp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2045,6 +2045,7 @@ static int remove_call(sccp_ctx *ctx, zend_op *opline, zend_ssa_op *ssa_op)
20452045
zend_op *op = call->arg_info[i].opline;
20462046
zend_ssa_op *this_ssa_op = &ssa->ops[op - op_array->opcodes];
20472047

2048+
/* TODO: move this code to somewhere common */
20482049
if (op->opcode == ZEND_SEND_VAR && this_ssa_op->op1_def >= 0) {
20492050
int op1_new = this_ssa_op->op1_use;
20502051
/* zend_ssa_rename_var_uses() clear use_chain & phi_use_chain for us */

0 commit comments

Comments
 (0)