Skip to content

Commit 3697648

Browse files
committed
Eliminate deafd stores
1 parent 6132389 commit 3697648

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

ext/opcache/jit/zend_jit_trace.c

+28-4
Original file line numberDiff line numberDiff line change
@@ -5687,8 +5687,23 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
56875687
if (type != IS_UNKNOWN) {
56885688
ssa->var_info[ssa_op->op1_def].type &= ~MAY_BE_GUARD;
56895689
if (ra && ra[ssa_op->op1_def]) {
5690-
SET_STACK_REG_EX(stack, EX_VAR_TO_NUM(opline->op1.var), ra[ssa_op->op1_def]->reg,
5691-
ra[ssa_op->op1_def]->flags & ZREG_STORE);
5690+
uint8_t flags = ra[ssa_op->op1_def]->flags & ZREG_STORE;
5691+
5692+
if (ssa_op->op1_use >= 0) {
5693+
if (opline->opcode == ZEND_SEND_VAR
5694+
|| opline->opcode == ZEND_CAST
5695+
|| opline->opcode == ZEND_QM_ASSIGN
5696+
|| opline->opcode == ZEND_JMP_SET
5697+
|| opline->opcode == ZEND_COALESCE
5698+
|| opline->opcode == ZEND_JMP_NULL
5699+
|| opline->opcode == ZEND_FE_RESET_R) {
5700+
if (!ra[ssa_op->op1_use]
5701+
|| ra[ssa_op->op1_use]->reg != ra[ssa_op->op1_def]->reg) {
5702+
flags |= ZREG_LOAD;
5703+
}
5704+
}
5705+
}
5706+
SET_STACK_REG_EX(stack, EX_VAR_TO_NUM(opline->op1.var), ra[ssa_op->op1_def]->reg, flags);
56925707
}
56935708
}
56945709
if (type == IS_LONG
@@ -5715,8 +5730,17 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
57155730
if (type != IS_UNKNOWN) {
57165731
ssa->var_info[ssa_op->op2_def].type &= ~MAY_BE_GUARD;
57175732
if (ra && ra[ssa_op->op2_def]) {
5718-
SET_STACK_REG_EX(stack, EX_VAR_TO_NUM(opline->op2.var), ra[ssa_op->op2_def]->reg,
5719-
ra[ssa_op->op2_def]->flags & ZREG_STORE);
5733+
uint8_t flags = ra[ssa_op->op2_def]->flags & ZREG_STORE;
5734+
5735+
if (ssa_op->op2_use >= 0) {
5736+
if (opline->opcode == ZEND_ASSIGN) {
5737+
if (!ra[ssa_op->op2_use]
5738+
|| ra[ssa_op->op2_use]->reg != ra[ssa_op->op2_def]->reg) {
5739+
flags |= ZREG_LOAD;
5740+
}
5741+
}
5742+
}
5743+
SET_STACK_REG_EX(stack, EX_VAR_TO_NUM(opline->op2.var), ra[ssa_op->op2_def]->reg, flags);
57205744
}
57215745
}
57225746
if (type == IS_LONG

0 commit comments

Comments
 (0)