Fix AOT ++/-- no-op on typed locals (#23840) - #23844
Merged
Merged
Conversation
) #23781 elided the resource guard via IncDecResourceProvenance::cannotBeResource() inside guardIncDecResourceOperand(), which made post-decrement a silent no-op for TYPE_VALUE KIND_VALUE locals that fell through to generic binaryOp lowering. Route scoped boxed locals through the value-box inc/dec path (isIncDecValueBoxLvalue) and remove the in-guard cannotBeResource early return so guard CFG matches Zend. cannotBeResourceForString() remains for int→string echo (#23811). Verified: php bin/compile.php -o /tmp/t '<?php $n=5; $n--; echo $n;' && /tmp/t # 4 script/differential-sweep.sh --aot --dir test/differential/cases (g08) vendor/bin/phpunit --filter incdec_post_dec_local Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Jul 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
371ada701):IncDecResourceProvenance::cannotBeResource()early-return insideguardIncDecResourceOperand()made post-decrement a silent no-op forTYPE_VALUEKIND_VALUElocals that used genericbinaryOplowering.isIncDecValueBoxLvalue()(includes typed locals bound to a scope slot).cannotBeResourceearly return;cannotBeResourceForString()remains for int→string echo (AOT: string conversion of an int renders "Resource id #N" when the value collides with a live handle #23811). Re-landing the Perf: skip the ++/-- resource guard when the value cannot be a resource (#23483) #23781 loop perf skip needs a follow-up that preserves guard CFG.Verification
Output:
$n--→4; differential AOTg08_incdec_post_dec.php1/1 match Zend;incdec_post_dec_localOK.Closes #23840
Made with Cursor