xref: /PHP-7.3/ext/opcache/tests/opt/sccp_007.phpt (revision 9fe6b293)
1--TEST--
2SCCP 007: Conditional Constant Propagation of non-escaping array elements
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(int $x) {
13	if ($x) {
14		$a = [0,1];
15	} else {
16		$a = [0,2];
17	}
18	echo $a[0];
19}
20?>
21--EXPECTF--
22$_main: ; (lines=1, args=0, vars=0, tmps=0)
23    ; (after optimizer)
24    ; %ssccp_007.php:1-11
25L0 (11):    RETURN int(1)
26
27foo: ; (lines=3, args=1, vars=1, tmps=0)
28    ; (after optimizer)
29    ; %ssccp_007.php:2-9
30L0 (2):     CV0($x) = RECV 1
31L1 (8):     ECHO int(0)
32L2 (9):     RETURN null
33