Skip to content

Commit 7bf6324

Browse files
committed
JIT: Fixed incorrect guard elimination
1 parent 9b2a3c1 commit 7bf6324

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

ext/opcache/jit/zend_jit_trace.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,8 @@ static const zend_op *zend_jit_trace_find_init_fcall_op(zend_jit_trace_rec *p, c
953953

954954
static int is_checked_guard(const zend_ssa *tssa, const zend_op **ssa_opcodes, uint32_t var, uint32_t phi_var)
955955
{
956-
if ((tssa->var_info[phi_var].type & MAY_BE_ANY) == MAY_BE_LONG) {
956+
if ((tssa->var_info[phi_var].type & MAY_BE_ANY) == MAY_BE_LONG
957+
&& !(tssa->var_info[var].type & MAY_BE_REF)) {
957958
int idx = tssa->vars[var].definition;
958959

959960
if (idx >= 0) {
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
JIT ASSIGN_OP: 003
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
--FILE--
9+
<?php
10+
function test() {
11+
$a = 0;
12+
for ($i = 0; $i < 10; $i++) {
13+
$a += $a;
14+
$a =& $x;
15+
$a += $a;
16+
}
17+
}
18+
test();
19+
?>
20+
DONE
21+
--EXPECT--
22+
DONE

0 commit comments

Comments
 (0)