[php-src] master: Eliminate useless spill stores (#19467)

From: Date: Wed, 13 Aug 2025 10:46:16 +0000
Subject: [php-src] master: Eliminate useless spill stores (#19467)
Groups: php.cvs 
Request: Send a blank email to [email protected] to get a copy of this message
Author: Dmitry Stogov (dstogov)
Committer: GitHub (web-flow)
Pusher: dstogov
Date: 2025-08-13T13:46:14+03:00

Commit: https://github.com/php/php-src/commit/290c9aef5628a31bdfd01b42a3a6625c1b1bc500
Raw diff: https://github.com/php/php-src/commit/290c9aef5628a31bdfd01b42a3a6625c1b1bc500.diff

Eliminate useless spill stores (#19467)

Changed paths:
  M  ext/opcache/jit/zend_jit_ir.c


Diff:

diff --git a/ext/opcache/jit/zend_jit_ir.c b/ext/opcache/jit/zend_jit_ir.c
index b1ebecc84a70..3ed9a5114756 100644
--- a/ext/opcache/jit/zend_jit_ir.c
+++ b/ext/opcache/jit/zend_jit_ir.c
@@ -4177,6 +4177,11 @@ static int zend_jit_spill_store_inv(zend_jit_ctx *jit, zend_jit_addr src,
zend_j
 	ZEND_ASSERT(Z_MODE(src) == IS_REG);
 	ZEND_ASSERT(Z_MODE(dst) == IS_MEM_ZVAL);
 
+	if (Z_LOAD(src) || Z_STORE(src)) {
+		/* it's not necessary to store register if it was previously loaded or already stored */
+		return 1;
+	}
+
 	if ((info & MAY_BE_ANY) == MAY_BE_LONG) {
 		jit_set_Z_LVAL(jit, dst, zend_jit_use_reg(jit, src));
 		if (Z_REG(dst) != ZREG_FP || !JIT_G(current_frame)) {


Thread (1 message)

  • Dmitry Stogov via GitHub
« previous php.cvs (#135277) next »