Skip to content

Commit 170ed1f

Browse files
committed
Otimize out useless QM_ASSIGN
1 parent 9518155 commit 170ed1f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

ext/opcache/Optimizer/block_pass.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,18 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
883883
/* strip T = QM_ASSIGN(T) */
884884
MAKE_NOP(opline);
885885
++(*opt_count);
886+
} else if (opline->op1_type == IS_TMP_VAR &&
887+
opline->result_type == IS_TMP_VAR &&
888+
!zend_bitset_in(used_ext, VAR_NUM(opline->op1.var))) {
889+
/* T1 = ..., T2 = QM_ASSIGN(T1) to T2 = ..., NOP */
890+
src = VAR_SOURCE(opline->op1);
891+
if (src) {
892+
src->result.var = opline->result.var;
893+
VAR_SOURCE(opline->op1) = NULL;
894+
VAR_SOURCE(opline->result) = src;
895+
MAKE_NOP(opline);
896+
++(*opt_count);
897+
}
886898
}
887899
break;
888900
}

0 commit comments

Comments
 (0)