[php-src] PR #20865: Split the live-ranges of loop variables again

From: Date: Thu, 08 Jan 2026 13:46:33 +0000
Subject: [php-src] PR #20865: Split the live-ranges of loop variables again
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-34477@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/20865 Author: bwoebi https://github.com/php/php-src/commit/b0af9ac7331e3efa0dcee4f43b2ba8b1e4e52f2f removed the live-range splitting of foreach variables, however it only added handling to ZEND_HANDLE_EXCEPTION. This was sort-of elegant, until it was realized in https://github.com/php/php-src/commit/8258b7731ba8cde929e1f3504577af0a4440cad4 that it would leak the return variable, requiring some more special handling. At some point we added live tmpvar rooting in https://github.com/php/php-src/commit/52cf7ab8a27ace6fbff60674d7aeecf4adec1bc8, but this did not take into account already freed loop variables, which also might happen during ZEND_RETURN, which cannot be trivially accounted for, without even more complicated handling in zend_gc_*_tmpvars() functions. This commit also proposes a simpler way of tracking the loop end in loopvar freeing ops: handle it directly during live range computation rather than during compilation, eliminating the need for opcache to handle it specifically. Further, opcache was using live_ranges in its basic block computation in the past, which it no longer does. Thus this complication is no longer necessary and this approach should be actually simpler now. Closes https://github.com/php/php-src/pull/20766.

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