Skip to content

Fix for 127141 - Remove unneeded spilling around profiler hooks#128731

Open
dhartglassMSFT wants to merge 4 commits into
dotnet:mainfrom
dhartglassMSFT:127141
Open

Fix for 127141 - Remove unneeded spilling around profiler hooks#128731
dhartglassMSFT wants to merge 4 commits into
dotnet:mainfrom
dhartglassMSFT:127141

Conversation

@dhartglassMSFT
Copy link
Copy Markdown
Contributor

On ARM64, only the lower halves of q8-q15 (128b) are callee save. LSRA spills upper halves of these into d8-d15 (64b subreg)

"UpperVectorSave" ref position tracks these around calls. LSRA currently just does this "upper-half-save-into-d8_d15" for all enregistered uppersave refs around calls.

Problem is PROF_HOOK does NOT kill q0-q7. So we end up with more enregistered refs around a profiler hook than may be handled by d8-d15.

Fix is that q0-q7 do not need their upper halves spilled around PROF_HOOK. I double checked with Noah that this is the case. And the asm stub does call out q0-q7 being preserved.

I was not able to recreate a repro, a profiled tail call taking v512 params seems to not be enough.

fixes #127141

Copilot AI review requested due to automatic review settings May 28, 2026 22:58
@github-actions github-actions Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label May 28, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@dhartglassMSFT dhartglassMSFT changed the title Fix for 127141 - too much spilling around profiler hooks Fix for 127141 - Remove unneeded spilling around profiler hooks May 29, 2026
@dhartglassMSFT dhartglassMSFT marked this pull request as ready for review May 29, 2026 18:32
Copilot AI review requested due to automatic review settings May 29, 2026 18:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread src/coreclr/jit/lsra.cpp
Comment on lines +5905 to +5906
// Normally, the only live physReg here would be callee-save (lower half only) d8-d15.
// But PROF_HOOK fully preserves q0-q7, so an UpperVectorSave here does not require a spill.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should be under arm64 ifdef, pushing a new commit

Comment thread src/coreclr/jit/lsra.cpp
Comment on lines +7428 to +7430
// PROF_HOOK preserves upper halves of q0-q7, LSRA must be told explicitly that saving these is not needed
// So skip the save if reg is assigned, ref is a PROF_HOOK, kill set does not contain reg, and reg is not
// a upper-half-only-called saved reg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test Failure: runtime-coreclr jitstress-random, assertion in lsra

2 participants