com php-src: Disable eliminatin of empty basic block with multiple predecessors: ext/opcache/Optimizer/dfa_pass.c ext/opcach e/tests/jmp_elim_003.phpt
| From: | Dmitry Stogov | Date: | Tue, 12 Sep 2017 06:54:45 +0000 |
| Subject: | com php-src: Disable eliminatin of empty basic block with multiple predecessors: ext/opcache/Optimizer/dfa_pass.c ext/opcach e/tests/jmp_elim_003.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-99375@lists.php.net to get a copy of this message | ||
Commit: 7921e0831b5cb645e6cc9487b1cdd6447dd56e81
Author: Dmitry Stogov <dmitry@zend.com> Tue, 12 Sep 2017 09:54:45 +0300
Parents: fec1bd0b41f1d8fc24ab1f0d6ccb44cb2ed4a855
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7921e0831b5cb645e6cc9487b1cdd6447dd56e81
Log:
Disable eliminatin of empty basic block with multiple predecessors
Changed paths:
M ext/opcache/Optimizer/dfa_pass.c
A ext/opcache/tests/jmp_elim_003.phpt
Diff:
diff --git a/ext/opcache/Optimizer/dfa_pass.c b/ext/opcache/Optimizer/dfa_pass..c
index ac40930..6e914e4 100644
--- a/ext/opcache/Optimizer/dfa_pass.c
+++ b/ext/opcache/Optimizer/dfa_pass.c
@@ -578,7 +578,7 @@ static void zend_ssa_replace_control_link(zend_op_array *op_array, zend_ssa *ssa
static void zend_ssa_unlink_block(zend_op_array *op_array, zend_ssa *ssa, zend_basic_block *block,
int block_num)
{
- if (block->predecessors_count && ssa->blocks[block_num].phis == NULL) {
+ if (block->predecessors_count == 1 && ssa->blocks[block_num].phis == NULL) {
int *predecessors, i;
ZEND_ASSERT(block->successors_count == 1);
diff --git a/ext/opcache/tests/jmp_elim_003.phpt b/ext/opcache/tests/jmp_elim_003.phpt
new file mode 100644
index 0000000..55be963
--- /dev/null
+++ b/ext/opcache/tests/jmp_elim_003.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Incorrect empty basic block elimination
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class A {
+ public static function test($args = array()) {
+ if (!function_exists( 'stream_socket_client'))
+ return false;
+
+ $is_ssl = isset( $args['ssl'] ) && $args['ssl'];
+
+ if ($is_ssl) {
+ if (!extension_loaded( 'openssl'))
+ return false;
+ if (!function_exists('openssl_x509_parse'))
+ return false;
+ }
+
+ return apply_filters('use_streams_transport', true, $args);
+ }
+}
+?>
+OK
+--EXPECT--
+OK