Skip to content

JIT: Read back parameter register replacements eagerly #112501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 21, 2025

Conversation

jakobbotsch
Copy link
Member

@jakobbotsch jakobbotsch commented Feb 12, 2025

Have physical promotion read replacements that map to parameter registers back eagerly in the entry basic block. Reading these back initially makes it more likely that the backend will be able to substitute directly for registers.
Motivated by some cases I saw where helper expansion ended up creating control flow before the readbacks, thus moving the parameter LCL_FLD nodes out of the entry BB and causing the backend to miss the optimization.

Have physical promotion read replacements that map to parameter
registers back eagerly in the entry basic block. Reading these back
initially makes it more likely that the backend will be able to
substitute directly for registers.
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Feb 12, 2025
Copy link
Contributor

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

@jakobbotsch jakobbotsch marked this pull request as ready for review February 21, 2025 10:12
@Copilot Copilot AI review requested due to automatic review settings February 21, 2025 10:12
Copy link
Contributor

@Copilot 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 wasn't able to review any files in this pull request.

Files not reviewed (2)
  • src/coreclr/jit/promotion.cpp: Language not supported
  • src/coreclr/jit/promotion.h: Language not supported

@jakobbotsch
Copy link
Member Author

cc @dotnet/jit-contrib PTAL @AndyAyersMS

Diffs, diffs with old promotion disabled.

The linux-x64 regressions look to be dominated by a single repeated regression.

I might also consider an alternative in the future where I save off all parameter LCL_FLD nodes during lowering and then apply the optimization more globally in the backend, instead of only looking in the entry BB. Will have to seriously consider that if we end up with more cases where the optimization is missed because the LCL_FLD nodes somehow flow out of the entry BB.

@jakobbotsch jakobbotsch merged commit 1eadeff into dotnet:main Feb 21, 2025
112 checks passed
@jakobbotsch jakobbotsch deleted the read-back-args-earlier branch February 21, 2025 20:33
@github-actions github-actions bot locked and limited conversation to collaborators Mar 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.

2 participants