[php-src] master: Evaluate ZEND_SPACESHIP in SCCP

From: Date: Thu, 08 Oct 2026 16:43:19 +0000
Subject: [php-src] master: Evaluate ZEND_SPACESHIP in SCCP
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-142088@lists.php.net to get a copy of this message
Author: ndossche (ndossche) Committer: Nora Dossche (ndossche) Date: 2026-10-08T18:43:09+02:00 Commit: https://github.com/php/php-src/commit/e28b0cf0dd99a599ef34e9d70d7e81a77d53220a Raw diff: https://github.com/php/php-src/commit/e28b0cf0dd99a599ef34e9d70d7e81a77d53220a.diff Evaluate ZEND_SPACESHIP in SCCP Changed paths: A ext/opcache/tests/opt/sccp_042.phpt M Zend/Optimizer/sccp.c Diff: diff --git a/Zend/Optimizer/sccp.c b/Zend/Optimizer/sccp.c index 07de22f85352..620cdd1f49f0 100644 --- a/Zend/Optimizer/sccp.c +++ b/Zend/Optimizer/sccp.c @@ -1283,6 +1283,7 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o case ZEND_IS_SMALLER_OR_EQUAL: case ZEND_IS_IDENTICAL: case ZEND_IS_NOT_IDENTICAL: + case ZEND_SPACESHIP: case ZEND_BW_OR: case ZEND_BW_AND: case ZEND_BW_XOR: diff --git a/ext/opcache/tests/opt/sccp_042.phpt b/ext/opcache/tests/opt/sccp_042.phpt new file mode 100644 index 000000000000..82c16fb6ea47 --- /dev/null +++ b/ext/opcache/tests/opt/sccp_042.phpt @@ -0,0 +1,42 @@ +--TEST-- +SCCP 042: SPACESHIP is evaluated for constant operands +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.opt_debug_level=0x20000 +opcache.preload= +--EXTENSIONS-- +opcache +--FILE-- +<?php +function test() { + $a = 1; + $b = 2; + return [$a <=> $b, $b <=> $a]; +} +var_dump(test()); +?> +--EXPECTF-- +$_main: + ; (lines=6, args=0, vars=0, tmps=%d) + ; (after optimizer) + ; %s +0000 INIT_FCALL 1 %d string("var_dump") +0001 INIT_FCALL 0 %d string("test") +0002 T0 = DO_UCALL +0003 SEND_VAL T0 1 +0004 DO_ICALL +0005 RETURN int(1) + +test: + ; (lines=1, args=0, vars=0, tmps=%d) + ; (after optimizer) + ; %s +0000 RETURN array(...) +array(2) { + [0]=> + int(-1) + [1]=> + int(1) +}

« previous php.cvs (#142088) next »