xref: /php-src/ext/opcache/tests/opt/dce_001.phpt (revision e48a5c14)
1--TEST--
2DCE 001: Remove dead computation after constants propagation
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.optimization_level=-1
7opcache.opt_debug_level=0x20000
8opcache.preload=
9zend_test.observer.enabled=0
10--EXTENSIONS--
11opcache
12--FILE--
13<?php
14function foo(string $s1, string $s2, string $s3, string $s4) {
15    $x = ($s1 . $s2) . ($s3 . $s4);
16    $x = 0;
17    return $x;
18}
19?>
20--EXPECTF--
21$_main:
22     ; (lines=1, args=0, vars=0, tmps=0)
23     ; (after optimizer)
24     ; %sdce_001.php:1-8
250000 RETURN int(1)
26
27foo:
28     ; (lines=5, args=4, vars=4, tmps=0)
29     ; (after optimizer)
30     ; %sdce_001.php:2-6
310000 CV0($s1) = RECV 1
320001 CV1($s2) = RECV 2
330002 CV2($s3) = RECV 3
340003 CV3($s4) = RECV 4
350004 RETURN int(0)
36