xref: /PHP-8.2/ext/opcache/tests/opt/dce_005.phpt (revision e48a5c14)
1--TEST--
2DCE 005: Elimination of assignment to non-escaping objects (can't remove NEW yet)
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
14#[AllowDynamicProperties]
15class A {
16}
17function foo(int $x) {
18    $a = new A;
19    $a->foo = $x;
20}
21?>
22--EXPECTF--
23$_main:
24     ; (lines=1, args=0, vars=0, tmps=0)
25     ; (after optimizer)
26     ; %s
270000 RETURN int(1)
28
29foo:
30     ; (lines=2, args=1, vars=1, tmps=0)
31     ; (after optimizer)
32     ; %s
330000 CV0($x) = RECV 1
340001 RETURN null
35