From bd78dc578e3559beb01be03bd5a70e5ae9f56e6b Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 3 Apr 2017 16:57:29 +0300 Subject: [PATCH] Expose zend_ssa_is_no_val_use() --- ext/opcache/Optimizer/zend_inference.c | 19 ++----------------- ext/opcache/Optimizer/zend_ssa.h | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index 9472f00f93..b3ec0c7a2a 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 5e03f8ba69..1130d9d62a 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 */ /* -- 2.50.1