Merged
Conversation
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an ARM64 JIT register allocation bug where LSRA (Linear Scan Register Allocator) fails under JIT register stress when allocating 4 consecutive registers that wrap around from d31 to d0, d1, d2 for SVE VectorTableLookup instructions.
Changes:
- Introduces a helper function
getNextFPRegWraparound()to correctly handle register wraparound from REG_FP_LAST to REG_FP_FIRST - Replaces bit-shift mask calculation with an iterative loop that properly handles the d31→d0 wraparound case
- Consolidates three instances of inline wraparound logic into calls to the new helper function
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/coreclr/jit/lsraarm64.cpp | Adds getNextFPRegWraparound() helper function and replaces the broken bit-shift mask calculation with a loop that correctly builds the consecutiveRegsInUseThisLocation mask by iterating through registers using the wraparound helper |
| src/coreclr/jit/lsra.h | Declares the new getNextFPRegWraparound() helper function in the LinearScan class under the TARGET_ARM64 conditional block |
jakobbotsch
approved these changes
Feb 24, 2026
Co-authored-by: Copilot <[email protected]>
This was referenced Feb 25, 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.
Running out of consecutive registers for arm64 under jit reg stress. Lsra is trying to place
C380, C381, V363, V364into four consecutive registersd31, d0, d1, d2for a VectorTableLookup (TBL) and runs out of registers when trying to assign V364 asd2.LSRA can normally handle this wraparound. Issue is that the C381 def also occupies d2, so d2 is incorrectly considered not available for V364. Normally this conflict is handled by the
LinearScan::consecutiveRegsInUseThisLocationmask - but the way the mask is calculated does not handle the d31->d0 wraparound properly.fixes #124357