com php-src: Allow SSA construction with source information about CV used as result: ext/opcache/Optimizer/zend_cfg.h ext/opcache/O ptimizer/zend_inference.c ext/opcache/Optimizer/zend_ss a.c
[email protected] (Dmitry Stogov)
| Newsgroups | php.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit: 6af1ffb57d097ae48ae11256c3323ecf2f042fe6 Author: Dmitry Stogov <[email protected]> Thu, 30 Mar 2017 20:14:01 +0300 Parents: 1f588df2a47bebd221a48f72dbe7e25ce10a041c Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6af1ffb57d097ae48ae11256c3323ecf2f042fe6 Log: Allow SSA construction with source information about CV used as result Changed paths: M ext/opcache/Optimizer/zend_cfg.h M ext/opcache/Optimizer/zend_inference.c M ext/opcache/Optimizer/zend_ssa.c Diff: diff --git a/ext/opcache/Optimizer/zend_cfg.h b/ext/opcache/Optimizer/zend_cfg.h index 7b80d83..d24bbd9 100644 --- a/ext/opcache/Optimizer/zend_cfg.h +++ b/ext/opcache/Optimizer/zend_cfg.h @@ -102,6 +102,7 @@ typedef struct _zend_cfg { #define ZEND_CFG_NO_ENTRY_PREDECESSORS (1<<25) #define ZEND_CFG_RECV_ENTRY (1<<24) #define ZEND_CALL_TREE (1<<23) +#define ZEND_SSA_USE_CV_RESULTS (1<<22) #define CRT_CONSTANT_EX(op_array, node, rt_constants) \ ((rt_constants) ? \ diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index 285d443..9472f00 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -250,6 +250,9 @@ static inline zend_bool is_no_val_use(const zend_op *opline, const zend_ssa_op * if (opline->opcode == ZEND_FE_FETCH_R) { 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 0; } diff --git a/ext/opcache/Optimizer/zend_ssa.c b/ext/opcache/Optimizer/zend_ssa.c index b393cd2..2f5f359 100644 --- a/ext/opcache/Optimizer/zend_ssa.c +++ b/ext/opcache/Optimizer/zend_ssa.c @@ -762,6 +762,10 @@ static int zend_ssa_rename(const zend_op_array *op_array, uint32_t build_flags, break; } if (opline->result_type == IS_CV) { + if ((build_flags & ZEND_SSA_USE_CV_RESULTS) + && opline->opcode != ZEND_RECV) { + ssa_ops[k].result_use = var[EX_VAR_TO_NUM(opline->result.var)]; + } ssa_ops[k].result_def = ssa_vars_count; var[EX_VAR_TO_NUM(opline->result.var)] = ssa_vars_count; ssa_vars_count++; @@ -1034,7 +1038,7 @@ int zend_ssa_compute_use_def_chains(zend_arena **arena, const zend_op_array *op_ op->op2_use_chain = ssa_vars[op->op2_use].use_chain; ssa_vars[op->op2_use].use_chain = i; } - if (op->result_use >= 0) { + if (op->result_use >= 0 && op->result_use != op->op1_use && op->result_use != op->op2_use) { op->res_use_chain = ssa_vars[op->result_use].use_chain; ssa_vars[op->result_use].use_chain = i; }