Skip to content

Commit 5e17d88

Browse files
committed
Improve register allocator (register reuse)
1 parent ea15909 commit 5e17d88

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4430,6 +4430,8 @@ static int zend_jit_math_double_double(dasm_State **Dst,
44304430
result_reg = Z_REG(res_addr);
44314431
} else if (Z_MODE(op1_addr) == IS_REG && Z_LAST_USE(op1_addr)) {
44324432
result_reg = Z_REG(op1_addr);
4433+
} else if (zend_is_commutative(opcode) && Z_MODE(op2_addr) == IS_REG && Z_LAST_USE(op2_addr)) {
4434+
result_reg = Z_REG(op2_addr);
44334435
} else {
44344436
result_reg = ZREG_XMM0;
44354437
}
@@ -15279,7 +15281,8 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
1527915281
}
1528015282
if ((op1_info & MAY_BE_DOUBLE) && (op2_info & MAY_BE_DOUBLE)) {
1528115283
if (ssa_op->result_def != current_var &&
15282-
(ssa_op->op1_use != current_var || !last_use)) {
15284+
(ssa_op->op1_use != current_var || !last_use) &&
15285+
(!zend_is_commutative(opline->opcode) || ssa_op->op2_use != current_var || !last_use)) {
1528315286
ZEND_REGSET_INCL(regset, ZREG_XMM0);
1528415287
}
1528515288
}

0 commit comments

Comments
 (0)