xref: /PHP-7.4/ext/opcache/tests/opt/sccp_009.phpt (revision 12edc453)
1--TEST--
2SCCP 009: 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
8opcache.preload=
9--SKIPIF--
10<?php require_once('skipif.inc'); ?>
11--FILE--
12<?php
13function foo(int $x) {
14	$a[0] = $x;
15	$a[1] = 2;
16	echo $a[1];
17}
18?>
19--EXPECTF--
20$_main: ; (lines=1, args=0, vars=0, tmps=0)
21    ; (after optimizer)
22    ; %ssccp_009.php:1-8
23L0 (8):     RETURN int(1)
24
25foo: ; (lines=3, args=1, vars=1, tmps=0)
26    ; (after optimizer)
27    ; %ssccp_009.php:2-6
28L0 (2):     CV0($x) = RECV 1
29L1 (5):     ECHO int(2)
30L2 (6):     RETURN null
31