diff --git a/ext/opcache/jit/zend_jit_ir.c b/ext/opcache/jit/zend_jit_ir.c index bea6c5f6651..5e90975a785 100644 --- a/ext/opcache/jit/zend_jit_ir.c +++ b/ext/opcache/jit/zend_jit_ir.c @@ -3540,11 +3540,14 @@ static void _zend_jit_fix_merges(zend_jit_ctx *jit) phi->op = IR_COPY; phi->op1 = phi->op2; phi->op2 = 1; + phi->inputs_count = 0; + } else { + phi->inputs_count = k + 1; } n2 = 1 + ((n + 1) >> 2); k2 = 1 + ((k + 1) >> 2); while (k2 != n2) { - (insn+k2)->optx = IR_NOP; + (phi+k2)->optx = IR_NOP; k2++; } phi += 1 + ((n + 1) >> 2); diff --git a/ext/opcache/tests/jit/loop_003.phpt b/ext/opcache/tests/jit/loop_003.phpt new file mode 100644 index 00000000000..4efc67e0a3d --- /dev/null +++ b/ext/opcache/tests/jit/loop_003.phpt @@ -0,0 +1,19 @@ +--TEST-- +JIT LOOP: 003 Incorrect dead IR edge elimination +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit_buffer_size=32M +--FILE-- + +DONE +--EXPECT-- +DONE