com php-src: Fix phi placement for pi targets: ext/opcache/Opti mizer/zend_ssa.c

From: Date: Thu, 12 May 2016 20:08:28 +0000
Subject: com php-src: Fix phi placement for pi targets: ext/opcache/Opti mizer/zend_ssa.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-92108@lists.php.net to get a copy of this message
Commit: b5bdb40cb576fa5b4d769580376ae34881c93574 Author: Nikita Popov <nikic@php.net> Thu, 12 May 2016 21:57:19 +0200 Parents: b1c3c9a525763ae9cd6e599bf061d7114d48aab0 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b5bdb40cb576fa5b4d769580376ae34881c93574 Log: Fix phi placement for pi targets If the pi target has multiple predecessors, we need to place a phi there. However it's not possible to express this in terms of dominance frontiers, so we need to explicitly add it to the phi set. This does not yet solve the problem of non-minimal SSA for the case where the target has multiple predecessors, but dominates all predecessors (apart from the one creating the pi) -- but that's an existing issue. Changed paths: M ext/opcache/Optimizer/zend_ssa.c Diff: diff --git a/ext/opcache/Optimizer/zend_ssa.c b/ext/opcache/Optimizer/zend_ssa.c index 3b5e45b..a008e10 100644 --- a/ext/opcache/Optimizer/zend_ssa.c +++ b/ext/opcache/Optimizer/zend_ssa.c @@ -95,6 +95,13 @@ static zend_ssa_phi *add_pi( * If there is a back-edge to "to" this may result in non-minimal SSA form. */ DFG_SET(dfg->def, dfg->size, to, var); + /* If there are multiple predecessors in the target block, we need to place a phi there. + * However this can (generally) not be expressed in terms of dominance frontiers, so place it + * explicitly. dfg->use here really is dfg->phi, we're reusing the set. */ + if (ssa->cfg.blocks[to].predecessors_count > 1) { + DFG_SET(dfg->use, dfg->size, to, var); + } + return phi; } /* }}} */

« previous php.cvs (#92108) next »