xref: /php-src/ext/opcache/tests/opt/dce_002.phpt (revision e48a5c14)
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=
9zend_test.observer.enabled=0
10--EXTENSIONS--
11opcache
12--FILE--
13<?php
14function foo(int $a) {
15    $a = 10;
16    $b = 20;
17    $x = func_get_args();
18    $a = 30;
19    $b = 40;
20    return $x;
21}
22?>
23--EXPECTF--
24$_main:
25     ; (lines=1, args=0, vars=0, tmps=0)
26     ; (after optimizer)
27     ; %sdce_002.php:1-11
280000 RETURN int(1)
29
30foo:
31     ; (lines=5, args=1, vars=2, tmps=0)
32     ; (after optimizer)
33     ; %sdce_002.php:2-9
340000 CV0($a) = RECV 1
350001 CV0($a) = QM_ASSIGN int(10)
360002 CV1($x) = FUNC_GET_ARGS
370003 CV0($a) = QM_ASSIGN int(30)
380004 RETURN CV1($x)
39