1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fixed assertion

This commit is contained in:
Dmitry Stogov
2023-11-03 02:16:08 +03:00
parent 4489d17146
commit 77312d8ea1
2 changed files with 56 additions and 7 deletions

View File

@@ -1301,13 +1301,14 @@ static void zend_jit_def_reg(zend_jit_ctx *jit, zend_jit_addr addr, ir_ref val)
if (jit->ra[dst_phi->ssa_var].ref > 0) {
ir_insn *phi_insn = &jit->ctx.ir_base[jit->ra[dst_phi->ssa_var].ref];
ZEND_ASSERT(phi_insn->op == IR_PHI);
// ZEND_ASSERT(ir_operands_count(ctx, phi_insn) == n + 1);
bb = &jit->ssa->cfg.blocks[dst_phi->block];
n = bb->predecessors_count;
for (j = 0, p = &dst_phi->sources[0], q = phi_insn->ops + 2; j < n; j++, p++, q++) {
if (*p == src_var) {
*q = val;
if (phi_insn->op == IR_PHI) {
// ZEND_ASSERT(ir_operands_count(ctx, phi_insn) == n + 1);
bb = &jit->ssa->cfg.blocks[dst_phi->block];
n = bb->predecessors_count;
for (j = 0, p = &dst_phi->sources[0], q = phi_insn->ops + 2; j < n; j++, p++, q++) {
if (*p == src_var) {
*q = val;
}
}
}
}

View File

@@ -0,0 +1,48 @@
--TEST--
Register Alloction 023: PI to PHI forwarding
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=1M
--FILE--
<?php
class test {
public function foo(string $key, int $start, int $end, ?string $type = null): void
{
if (isset($this->a[$key])) {
foreach ($this->a[$key] as $i => $data) {
if ($data->from >= $start && $data->from <= $end) {
if ($type === null || $type === $data->type) {
unset($this->a[$key][$i]);
}
}
}
}
if (isset($this->type_map[$key])) {
foreach ($this->b[$key] as $map_start => $_) {
if ($map_start >= $start && $map_start <= $end) {
unset($this->b[$key][$map_start]);
}
}
}
if (isset($this->c[$key])) {
foreach ($this->c[$key] as $map_start => $_) {
if ($map_start >= $start && $map_start <= $end) {
unset($this->c[$key][$map_start]);
}
}
}
if (isset($this->d[$key])) {
foreach ($this->d[$key] as $map_start => $_) {
if ($map_start >= $start && $map_start <= $end) {
unset($this->d[$key][$map_start]);
}
}
}
}
}
?>
DONE
--EXPECT--
DONE