xref: /PHP-7.3/ext/opcache/tests/opt/dce_001.phpt (revision 9fe6b293)
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
8--SKIPIF--
9<?php require_once('skipif.inc'); ?>
10--FILE--
11<?php
12function foo(string $s1, string $s2, string $s3, string $s4) {
13	$x = ($s1 . $s2) . ($s3 . $s4);
14	$x = 0;
15	return $x;
16}
17?>
18--EXPECTF--
19$_main: ; (lines=1, args=0, vars=0, tmps=0)
20    ; (after optimizer)
21    ; %sdce_001.php:1-8
22L0 (8):     RETURN int(1)
23
24foo: ; (lines=5, args=4, vars=4, tmps=0)
25    ; (after optimizer)
26    ; %sdce_001.php:2-6
27L0 (2):     CV0($s1) = RECV 1
28L1 (2):     CV1($s2) = RECV 2
29L2 (2):     CV2($s3) = RECV 3
30L3 (2):     CV3($s4) = RECV 4
31L4 (5):     RETURN int(0)
32