Skip to content

Commit 85a86e5

Browse files
committed
Remove unusded phi
1 parent d5e0f2d commit 85a86e5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

ext/opcache/Optimizer/sccp.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,9 @@ static int replace_constant_operands(sccp_ctx *ctx) {
12801280
zend_op *opline = &op_array->opcodes[use];
12811281
zend_ssa_op *ssa_op = &ssa->ops[use];
12821282
if (try_replace_op1(ctx, opline, ssa_op, i, value)) {
1283+
if (opline->opcode == ZEND_NOP) {
1284+
removed_ops++;
1285+
}
12831286
ZEND_ASSERT(ssa_op->op1_def == -1);
12841287
if (ssa_op->op1_use != ssa_op->op2_use) {
12851288
zend_ssa_unlink_use_chain(ssa, use, ssa_op->op1_use);
@@ -1392,11 +1395,12 @@ static int replace_constant_operands(sccp_ctx *ctx) {
13921395
Z_TRY_ADDREF_P(value);
13931396
}
13941397
}
1395-
/*if (var->definition_phi
1398+
if (var->definition_phi
1399+
&& value_known(&ctx->values[i])
13961400
&& var->use_chain < 0
1397-
&& ssa->phi_use_chain == NULL) {
1401+
&& var->phi_use_chain == NULL) {
13981402
zend_ssa_remove_phi(ssa, var->definition_phi);
1399-
}*/
1403+
}
14001404
}
14011405

14021406
return removed_ops;

0 commit comments

Comments
 (0)