xref: /PHP-7.4/ext/opcache/tests/opt/dce_002.phpt (revision 12edc453)
1--TEST--
2DCE 002: func_get_args() disables deletion of assignments to parameter variables
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.optimization_level=-1
7opcache.opt_debug_level=0x20000
8opcache.preload=
9--SKIPIF--
10<?php require_once('skipif.inc'); ?>
11--FILE--
12<?php
13function foo(int $a) {
14	$a = 10;
15	$b = 20;
16	$x = func_get_args();
17	$a = 30;
18	$b = 40;
19	return $x;
20}
21?>
22--EXPECTF--
23$_main: ; (lines=1, args=0, vars=0, tmps=0)
24    ; (after optimizer)
25    ; %sdce_002.php:1-11
26L0 (11):    RETURN int(1)
27
28foo: ; (lines=5, args=1, vars=2, tmps=0)
29    ; (after optimizer)
30    ; %sdce_002.php:2-9
31L0 (2):     CV0($a) = RECV 1
32L1 (3):     CV0($a) = QM_ASSIGN int(10)
33L2 (5):     CV1($x) = FUNC_GET_ARGS
34L3 (6):     CV0($a) = QM_ASSIGN int(30)
35L4 (8):     RETURN CV1($x)
36