Skip to content
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

JIT: Move return merging from fgAddInternal to a late phase #107663

Open
EgorBo opened this issue Sep 10, 2024 · 3 comments
Open

JIT: Move return merging from fgAddInternal to a late phase #107663

EgorBo opened this issue Sep 10, 2024 · 3 comments
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone

Comments

@EgorBo
Copy link
Member

EgorBo commented Sep 10, 2024

Currently, we perform tail merging in fgAddInternal phase which is performed right after inlining. There, we minimize the number of tails (BBJ_RETURN) to 4 (I guess it's driven by legacy jit32 gc encoder having a hard limit on epilogues, but we use this threshold for other targets as well). It seems that it might break some control-flow optimizations, should we move this merging to a later phase? ideally when we know exactly the cost of an epilogue.

cc @AndyAyersMS @amanasifkhalid @dotnet/jit-contrib

@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 Sep 10, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Sep 10, 2024
Copy link
Contributor

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

@EgorBo EgorBo changed the title JIT: Move epilogue merging to a later phase JIT: Move return merging from fgAddInternal to a late phase Sep 10, 2024
@EgorBo EgorBo added this to the Future milestone Sep 10, 2024
@EgorBo EgorBo removed the untriaged New issue has not been triaged by the area owner label Sep 10, 2024
@AndyAyersMS
Copy link
Member

Also see #8406, #8883

@jakobbotsch
Copy link
Member

One thing to consider is also how to handle multi-reg returns properly in these scenarios. Today we introduce the shared return temp as part of the return merging, which happens before promotion, so the return temp naturally gets promoted and multi-reg returns work fine in these scenarios.
If we do this later we will likely need to do some manual (physical) promotion of the shared return temporary that we end up introducing, in combination with something like #86665 to actually allow returning its fields in registers.

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

No branches or pull requests

3 participants