com php-src: Fixed SSA construction for CFG with unreachable BB: ext/opcache/Optimizer/zend_ssa.c ext/opcache/tests/ssa_ bug_001.phpt

From: Date: Wed, 23 Dec 2015 00:52:38 +0000
Subject: com php-src: Fixed SSA construction for CFG with unreachable BB: ext/opcache/Optimizer/zend_ssa.c ext/opcache/tests/ssa_ bug_001.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-90407@lists.php.net to get a copy of this message
Commit: 28a016a6dca22566a6126b2b995fddcb8125c5e5 Author: Dmitry Stogov <dmitry@zend.com> Wed, 23 Dec 2015 03:52:38 +0300 Parents: 1e3ab158432f8d97c3561fdfc17b7e4aa3dbdd60 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=28a016a6dca22566a6126b2b995fddcb8125c5e5 Log: Fixed SSA construction for CFG with unreachable BB Changed paths: M ext/opcache/Optimizer/zend_ssa.c A ext/opcache/tests/ssa_bug_001.phpt Diff: diff --git a/ext/opcache/Optimizer/zend_ssa.c b/ext/opcache/Optimizer/zend_ssa.c index 46c3928..d9e8516 100644 --- a/ext/opcache/Optimizer/zend_ssa.c +++ b/ext/opcache/Optimizer/zend_ssa.c @@ -495,7 +495,7 @@ int zend_build_ssa(zend_arena **arena, const zend_op_array *op_array, uint32_t b zend_bitset_copy(tmp, gen + (j * set_size), set_size); for (k = 0; k < blocks[j].predecessors_count; k++) { i = ssa->cfg..predecessors[blocks[j].predecessor_offset + k]; - while (i != blocks[j].idom) { + while (i != -1 && i != blocks[j].idom) { zend_bitset_union_with_intersection(tmp, tmp, gen + (i * set_size), in + (j * set_size), set_size); i = blocks[i].idom; } @@ -530,7 +530,7 @@ int zend_build_ssa(zend_arena **arena, const zend_op_array *op_array, uint32_t b } else { for (k = 0; k < blocks[j].predecessors_count; k++) { i = ssa->cfg.predecessors[blocks[j].predecessor_offset + k]; - while (i != blocks[j].idom) { + while (i != -1 && i != blocks[j].idom) { zend_bitset_union_with_intersection(tmp, tmp, gen + (i * set_size), in + (j * set_size), set_size); i = blocks[i].idom; } @@ -802,7 +802,7 @@ int zend_build_ssa(zend_arena **arena, const zend_op_array *op_array, uint32_t b } else { for (k = 0; k < blocks[j].predecessors_count; k++) { i = ssa->cfg.predecessors[blocks[j].predecessor_offset + k]; - while (i != blocks[j].idom) { + while (i != -1 && i != blocks[j].idom) { zend_ssa_phi *p = ssa_blocks[i].phis; while (p) { if (p) { diff --git a/ext/opcache/tests/ssa_bug_001.phpt b/ext/opcache/tests/ssa_bug_001.phpt new file mode 100644 index 0000000..56757f5 --- /dev/null +++ b/ext/opcache/tests/ssa_bug_001.phpt @@ -0,0 +1,19 @@ +--TEST-- +SSA constrution for CFG with unreachable basic blocks +--FILE-- +<?php +class X { + public function __get($n) { + if ($n === 'type') { + trigger_error('Deprecated type property called; use instanceof', E_USER_NOTICE); + switch (get_class($this)) { + case 'HTMLPurifier_Token_Start': return 'start'; + default: return null; + } + } + } +} +?> +OK +--EXPECT-- +OK

« previous php.cvs (#90407) next »