com php-src: Fixed edge-case in SSA use/def chain construction and type inference.: ext/opcache/Optimizer/zend_ssa.h
| From: | Dmitry Stogov | Date: | Mon, 04 Sep 2017 18:58:24 +0000 |
| Subject: | com php-src: Fixed edge-case in SSA use/def chain construction and type inference.: ext/opcache/Optimizer/zend_ssa.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-99250@lists.php.net to get a copy of this message | ||
Commit: 384da65a97f1a2630454a319921cc279c7a286db
Author: Dmitry Stogov <dmitry@zend.com> Mon, 4 Sep 2017 21:58:24 +0300
Parents: b5935c339e490dbf63cd1635ac45593310d6838c
Branches: PHP-7.2 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=384da65a97f1a2630454a319921cc279c7a286db
Log:
Fixed edge-case in SSA use/def chain construction and type inference.
Changed paths:
M ext/opcache/Optimizer/zend_ssa.h
Diff:
diff --git a/ext/opcache/Optimizer/zend_ssa.h b/ext/opcache/Optimizer/zend_ssa.h
index b281305..1af4fab 100644
--- a/ext/opcache/Optimizer/zend_ssa.h
+++ b/ext/opcache/Optimizer/zend_ssa.h
@@ -180,10 +180,13 @@ END_EXTERN_C()
static zend_always_inline int zend_ssa_next_use(const zend_ssa_op *ssa_op, int var, int use)
{
ssa_op += use;
- if (ssa_op->result_use == var) {
+ if (ssa_op->op1_use == var) {
+ return ssa_op->op1_use_chain;
+ } else if (ssa_op->op2_use == var) {
+ return ssa_op->op2_use_chain;
+ } else {
return ssa_op->res_use_chain;
}
- return (ssa_op->op1_use == var) ? ssa_op->op1_use_chain : ssa_op->op2_use_chain;
}
static zend_always_inline zend_ssa_phi* zend_ssa_next_use_phi(const zend_ssa *ssa, int var, const
zend_ssa_phi *p)
@@ -210,7 +213,7 @@ static zend_always_inline zend_bool zend_ssa_is_no_val_use(const zend_op *opline
return ssa_op->op2_use == var && ssa_op->op1_use != var;
}
if (ssa_op->result_use == var && opline->opcode != ZEND_ADD_ARRAY_ELEMENT) {
- return 1;
+ return ssa_op->op1_use != var && ssa_op->op2_use != var;
}
return 0;
}