com php-src: Fixed removing dead live ranges: ext/opcache/Optimizer/sccp.c ext/opcache/Optimizer/zend_optimizer.c ext/opcache/Optimi zer/zend_ssa.c
| From: | Dmitry Stogov | Date: | Mon, 14 Aug 2017 10:54:52 +0000 |
| Subject: | com php-src: Fixed removing dead live ranges: ext/opcache/Optimizer/sccp.c ext/opcache/Optimizer/zend_optimizer.c ext/opcache/Optimi zer/zend_ssa.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-99014@lists.php.net to get a copy of this message | ||
Commit: df5104bfc9419813c3262180dc7f191a615c8e84
Author: Dmitry Stogov <dmitry@zend.com> Mon, 14 Aug 2017 13:54:52 +0300
Parents: 112afb9250323b0c6f8e132471e1d6810d4993cd
Branches: PHP-7.2 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=df5104bfc9419813c3262180dc7f191a615c8e84
Log:
Fixed removing dead live ranges
Changed paths:
M ext/opcache/Optimizer/sccp.c
M ext/opcache/Optimizer/zend_optimizer.c
M ext/opcache/Optimizer/zend_ssa.c
Diff:
diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c
index cd74ea4..24af78e 100644
--- a/ext/opcache/Optimizer/sccp..c
+++ b/ext/opcache/Optimizer/sccp.c
@@ -1459,7 +1459,7 @@ static int replace_constant_operands(sccp_ctx *ctx) {
ZEND_ASSERT(call);
ZEND_ASSERT(call->caller_call_opline == opline);
if (opline->result_type & (IS_TMP_VAR|IS_VAR)) {
- zend_optimizer_remove_live_range_ex(op_array, opline->result..var, var->definition +
1);
+ zend_optimizer_remove_live_range_ex(op_array, opline->result.var, var->definition);
}
zend_ssa_remove_result_def(ssa, ssa_op);
zend_ssa_remove_instr(ssa, opline, ssa_op);
@@ -1477,7 +1477,7 @@ static int replace_constant_operands(sccp_ctx *ctx) {
} else {
/* Ordinary computational instruction -> remove it */
if (opline->result_type & (IS_TMP_VAR|IS_VAR)) {
- zend_optimizer_remove_live_range_ex(op_array, opline->result..var, var->definition +
1);
+ zend_optimizer_remove_live_range_ex(op_array, opline->result.var, var->definition);
}
zend_ssa_remove_result_def(ssa, ssa_op);
zend_ssa_remove_instr(ssa, opline, ssa_op);
@@ -1502,7 +1502,7 @@ static int replace_constant_operands(sccp_ctx *ctx) {
&& ssa->vars[ssa_op->result_def].use_chain < 0
&& ssa->vars[ssa_op->result_def].phi_use_chain == NULL) {
if (opline->result_type & (IS_TMP_VAR|IS_VAR)) {
- zend_optimizer_remove_live_range_ex(op_array, opline->result.var, var->definition + 1);
+ zend_optimizer_remove_live_range_ex(op_array, opline->result.var, var->definition);
}
zend_ssa_remove_result_def(ssa, ssa_op);
opline->result_type = IS_UNUSED;
diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c
index 4b56809..8991722 100644
--- a/ext/opcache/Optimizer/zend_optimizer.c
+++ b/ext/opcache/Optimizer/zend_optimizer.c
@@ -557,6 +557,24 @@ void zend_optimizer_remove_live_range_ex(zend_op_array *op_array, uint32_t var,
{
uint32_t i = 0;
+ switch (op_array->opcodes[start].opcode) {
+ case ZEND_ROPE_ADD:
+ case ZEND_ADD_ARRAY_ELEMENT:
+ return;
+ case ZEND_ROPE_INIT:
+ var |= ZEND_LIVE_ROPE;
+ break;
+ case ZEND_BEGIN_SILENCE:
+ var |= ZEND_LIVE_SILENCE;
+ break;
+ case ZEND_FE_RESET_R:
+ case ZEND_FE_RESET_RW:
+ var |= ZEND_LIVE_LOOP;
+ /* break missing intentionally */
+ default:
+ start++;
+ }
+
while (i < op_array->last_live_range) {
if (op_array->live_range[i].var == var
&& op_array->live_range[i].start == start) {
diff --git a/ext/opcache/Optimizer/zend_ssa.c b/ext/opcache/Optimizer/zend_ssa.c
index a82d7ff..e100be4 100644
--- a/ext/opcache/Optimizer/zend_ssa.c
+++ b/ext/opcache/Optimizer/zend_ssa.c
@@ -1362,7 +1362,7 @@ void zend_ssa_remove_block(zend_op_array *op_array, zend_ssa *ssa, int i) /*
{{{
}
if (op_array->opcodes[j].result_type & (IS_TMP_VAR|IS_VAR)) {
- zend_optimizer_remove_live_range_ex(op_array, op_array->opcodes[j].result.var, j + 1);
+ zend_optimizer_remove_live_range_ex(op_array, op_array->opcodes[j].result.var, j);
}
zend_ssa_remove_defs_of_instr(ssa, &ssa->ops[j]);
zend_ssa_remove_instr(ssa, &op_array->opcodes[j], &ssa->ops[j]);