Skip to content

Commit 54bbee9

Browse files
committed
Check for no uses before removing result operand
It's possible for there to still be phi uses.
1 parent fa3d603 commit 54bbee9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Zend/Optimizer/sccp.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2191,8 +2191,10 @@ static int try_remove_definition(sccp_ctx *ctx, int var_num, zend_ssa_var *var,
21912191
if (ssa_op->result_def == var_num) {
21922192
if (opline->opcode == ZEND_ASSIGN) {
21932193
/* We can't drop the ASSIGN, but we can remove the result. */
2194-
opline->result_type = IS_UNUSED;
2195-
zend_ssa_remove_result_def(ssa, ssa_op);
2194+
if (var->use_chain < 0 && var->phi_use_chain == NULL) {
2195+
opline->result_type = IS_UNUSED;
2196+
zend_ssa_remove_result_def(ssa, ssa_op);
2197+
}
21962198
return 0;
21972199
}
21982200
if (ssa_op->op1_def >= 0

0 commit comments

Comments
 (0)