]> granicus.if.org Git - php/commitdiff
Fix DCE test
authorNikita Popov <nikita.ppv@gmail.com>
Sun, 18 Feb 2018 14:37:10 +0000 (15:37 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Sun, 18 Feb 2018 14:37:10 +0000 (15:37 +0100)
Without the type hint the previous optimization no longer applied,
as the result could be an (overloaded) object, which might have
caused dtor effect reordering.

ext/opcache/tests/opt/dce_003.phpt

index ce453c0ca39035fe38058b89ecbf1d8447cdca99..017f2c404062365c8f99b18d1fb1760579a26d4e 100644 (file)
@@ -9,7 +9,7 @@ opcache.opt_debug_level=0x20000
 <?php require_once('skipif.inc'); ?>
 --FILE--
 <?php
-function foo($a) {
+function foo(int $a) {
        $b = $a += 3;
        return $a;
 }
@@ -24,5 +24,5 @@ foo: ; (lines=3, args=1, vars=1, tmps=0)
     ; (after optimizer)
     ; %sdce_003.php:2-5
 L0 (2):     CV0($a) = RECV 1
-L1 (3):     ASSIGN_ADD CV0($a) int(3)
+L1 (3):     CV0($a) = ADD CV0($a) int(3)
 L2 (4):     RETURN CV0($a)