Perf: lazy f64 overflow slot for native-long ±/× (#36386) - #37051
Merged
Conversation
Keep typed int arith hot path free of entryAllocaValueBox: overflow stores an f64 and only boxes on materialize (var_dump / untyped). fibo_r no longer allocates three dead %__value__ per +/- site. Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Sep 6, 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
+/-/*overflow no longer doesentryAllocaValueBox+TYPE_NULLinit on every arith site. The cold path stores anf64in a plain entry alloca;__value__boxing happens only inmaterializeOverflowableNativeLong(var_dump / untyped consumers).i64phi (dummy0on overflow) and keeps thellvm.*.with.overflow.i64i1 SSA as the flag — no i1/i64 shadow allocas.fibo_rIR: 0alloca %__value__, 0__value__writeDouble(was 3 each).Zend/zend_operators.hZEND_SIGNED_*_OVERFLOW/fast_long_sub_function.Part of #36386 (does not close the epic).
Test plan
./script/phpunit.sh --filter 'NativeLongOverflowHeapLazyAotTest|IntArithOverflowPromote31964AotTest'→ 3/3./script/aot-smoke.sh→ 9/9 + size gate OKalloca %__value__= 0,phi i64present, runfibo_r(10)→55IntSubOverflowPromote32422AotTest/StrIntOverflow*AOT cases withPHP_COMPILER_HELPER_RUNTIME_O=0already segfault on master (reproduced without this diff); not a regression from this PR.Made with Cursor