com php-src: Expose zend_ssa_is_no_val_use(): ext/opcache/Optimizer/zend_inference.c ext/opcache/Opt imizer/zend_ssa.h
[email protected] (Dmitry Stogov)
| Newsgroups | php.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit: bd78dc578e3559beb01be03bd5a70e5ae9f56e6b Author: Dmitry Stogov <[email protected]> Mon, 3 Apr 2017 16:57:29 +0300 Parents: 6ab2c558f1862194c6dd4b1ed7f8ce63474349ae Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=bd78dc578e3559beb01be03bd5a70e5ae9f56e6b Log: Expose zend_ssa_is_no_val_use() Changed paths: M ext/opcache/Optimizer/zend_inference.c M ext/opcache/Optimizer/zend_ssa.h Diff: diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index 9472f00..b3ec0c7 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -241,21 +241,6 @@ int zend_ssa_find_sccs(const zend_op_array *op_array, zend_ssa *ssa) /* {{{ */ } /* }}} */ -static inline zend_bool is_no_val_use(const zend_op *opline, const zend_ssa_op *ssa_op, int var) -{ - if (opline->opcode == ZEND_ASSIGN || - (opline->opcode == ZEND_UNSET_VAR && (opline->extended_value & ZEND_QUICK_SET))) { - return ssa_op->op1_use == var && ssa_op->op2_use != var; - } - 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; -} - int zend_ssa_find_false_dependencies(const zend_op_array *op_array, zend_ssa *ssa) /* {{{ */ { zend_ssa_var *ssa_vars = ssa->vars; @@ -277,7 +262,7 @@ int zend_ssa_find_false_dependencies(const zend_op_array *op_array, zend_ssa *ss ssa_vars[i].no_val = 1; /* mark as unused */ use = ssa->vars[i].use_chain; while (use >= 0) { - if (!is_no_val_use(&op_array->opcodes[use], &ssa->ops[use], i)) { + if (!zend_ssa_is_no_val_use(&op_array->opcodes[use], &ssa->ops[use], i)) { ssa_vars[i].no_val = 0; /* used directly */ zend_bitset_incl(worklist, i); break; @@ -3395,7 +3380,7 @@ static zend_bool can_convert_to_double( zend_op *opline = &op_array->opcodes[use]; zend_ssa_op *ssa_op = &ssa->ops[use]; - if (is_no_val_use(opline, ssa_op, var_num)) { + if (zend_ssa_is_no_val_use(opline, ssa_op, var_num)) { continue; } diff --git a/ext/opcache/Optimizer/zend_ssa.h b/ext/opcache/Optimizer/zend_ssa.h index 5e03f8b..1130d9d 100644 --- a/ext/opcache/Optimizer/zend_ssa.h +++ b/ext/opcache/Optimizer/zend_ssa.h @@ -157,6 +157,21 @@ static zend_always_inline zend_ssa_phi* zend_ssa_next_use_phi(const zend_ssa *ss return NULL; } +static zend_always_inline zend_bool zend_ssa_is_no_val_use(const zend_op *opline, const zend_ssa_op *ssa_op, int var) +{ + if (opline->opcode == ZEND_ASSIGN || + (opline->opcode == ZEND_UNSET_VAR && (opline->extended_value & ZEND_QUICK_SET))) { + return ssa_op->op1_use == var && ssa_op->op2_use != var; + } + 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; +} + #endif /* ZEND_SSA_H */ /*