summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-12-10 09:01:18 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-12-10 09:01:18 +0100
commit7e028a41e2c33504e1f9bc099c9882a7764137da (patch)
tree0dcf42015b5254b2e3a661edd0a68d80e8b3071e
parent505cc77cbeb8a43dab446ecba0c867c453588a52 (diff)
parent87691e74e54ab4303d6f6ea826b7bc1555112e4d (diff)
downloadphp-git-7e028a41e2c33504e1f9bc099c9882a7764137da.tar.gz
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix DCE with FE_FETCH
-rw-r--r--ext/opcache/Optimizer/zend_ssa.h7
-rw-r--r--ext/opcache/tests/fe_fetch_dce.phpt22
2 files changed, 27 insertions, 2 deletions
diff --git a/ext/opcache/Optimizer/zend_ssa.h b/ext/opcache/Optimizer/zend_ssa.h
index a921a5bbe0..cec021bd9b 100644
--- a/ext/opcache/Optimizer/zend_ssa.h
+++ b/ext/opcache/Optimizer/zend_ssa.h
@@ -217,12 +217,15 @@ static zend_always_inline zend_bool zend_ssa_is_no_val_use(const zend_op *opline
if (opline->opcode == ZEND_ASSIGN || opline->opcode == ZEND_UNSET_CV) {
return ssa_op->op1_use == var && ssa_op->op2_use != var;
}
- if (opline->opcode == ZEND_FE_FETCH_R) {
+ // TODO: Reenable this after changing the SSA structure.
+ /*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
&& opline->opcode != ZEND_ADD_ARRAY_UNPACK) {
+ }
+ if (ssa_op->result_use == var && opline->opcode != ZEND_ADD_ARRAY_ELEMENT) {
return ssa_op->op1_use != var && ssa_op->op2_use != var;
}
return 0;
diff --git a/ext/opcache/tests/fe_fetch_dce.phpt b/ext/opcache/tests/fe_fetch_dce.phpt
new file mode 100644
index 0000000000..f7ff0203d7
--- /dev/null
+++ b/ext/opcache/tests/fe_fetch_dce.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Incorrect DCE with FE_FETCH
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+--FILE--
+<?php
+
+function test() {
+ $a = ["3"];
+ $x = 1;
+ foreach ($a as $x) {
+ $x = 2.0;
+ }
+ var_dump($x);
+}
+test();
+
+?>
+--EXPECT--
+float(2)