[php-src] PR #23952: JIT: Use interned constants for offsets in jit_ADD_OFFSET()

From: Date: Sun, 27 Sep 2026 21:30:17 +0000
Subject: [php-src] PR #23952: JIT: Use interned constants for offsets in jit_ADD_OFFSET()
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-38867@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/23952 Author: ndossche jit_ADD_OFFSET() created the offset through jit_CONST_ADDR(), which returns a unique (non-interned) constant. IR's own folding of nested offsets, ADD(ADD(x, c1), c2), creates an interned constant for c1+c2. The same address can therefore end up with two different offset refs, and CSE and store-to-load forwarding, which both need an identical address ref, miss it. The uniqueing exists likely for the exit addresses mostly, but for offsets this is wrong. For example, the type store and the type load of the same zval end up with different refs: ```php function count_big($n) { $c = 0; for ($i = 0; $i < $n; $i++) { $big = $i > 5; if ($big) { $c++; } } return $c; } ``` Loop body before: ```asm movl %esi, 0x88(%r14) cmpb $3, 0x88(%r14) jne jit$$trace_exit_4 ``` After: ```asm movl %esi, 0x88(%r14) cmpb $3, %sil ; no reload jne jit$$trace_exit_4 ``` In general, more redundant loads can be avoided, and in some cases type guards can be eliminated due to store->load forwarding.

« previous php.git-pulls (#38867) next »