xref: /php-src/ext/opcache/tests/opt/sccp_012.phpt (revision e48a5c14)
1--TEST--
2SCCP 012: Conditional Constant Propagation of non-escaping object properties
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() {
15    $o = new stdClass();
16    $o->foo = 0;
17    $i = 1;
18    $c = $i < 2;
19    if ($c) {
20        $k = 2 * $i;
21        $o->foo = $i;
22        echo $o->foo;
23    }
24    $o->foo += 2;
25    $o->foo++;
26    echo $o->foo;
27}
28?>
29--EXPECTF--
30$_main:
31     ; (lines=1, args=0, vars=0, tmps=0)
32     ; (after optimizer)
33     ; %ssccp_012.php:1-17
340000 RETURN int(1)
35
36foo:
37     ; (lines=3, args=0, vars=0, tmps=0)
38     ; (after optimizer)
39     ; %ssccp_012.php:2-15
400000 ECHO string("1")
410001 ECHO string("4")
420002 RETURN null
43