xref: /PHP-8.1/ext/opcache/tests/opt/sccp_009.phpt (revision e9f783fc)
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--EXTENSIONS--
10opcache
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:
21     ; (lines=1, args=0, vars=0, tmps=0)
22     ; (after optimizer)
23     ; %ssccp_009.php:1-8
240000 RETURN int(1)
25
26foo:
27     ; (lines=3, args=1, vars=1, tmps=0)
28     ; (after optimizer)
29     ; %ssccp_009.php:2-6
300000 CV0($x) = RECV 1
310001 ECHO string("2")
320002 RETURN null
33