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

[Arm64] Extend Compiler::lvaFrameAddress() and JIT to allow using SP as base register #47810

Open
echesakov opened this issue Feb 3, 2021 · 1 comment
Labels
arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI optimization Priority:2 Work that is important, but not critical for the release
Milestone

Comments

@echesakov
Copy link
Contributor

echesakov commented Feb 3, 2021

At the moment, on Arm64 we always establish frame pointer when allocating a stack frame. Given that fact and based on the logic in Compiler::lvaFrameAddress() the JIT would always use fp as a base register for addressing locals and temps. This can lead to un-optimal codegen in a situation when the JIT is required to use frameType=5 (i.e., when fp points to a location above locals) instead of frameType=3 (i.e., when fp points to a location below locals). The following is a snippet of such un-optimal codegen when such restriction on fp value is imposed:

-;  V285 tmp284      [V285    ] (  2,  4   )  struct ( 8) [fp+0x1C50]   do-not-enreg[XSB] addr-exposed "Inlining Arg"
+;  V285 tmp284      [V285    ] (  2,  4   )  struct ( 8) [fp-0x7E8]   do-not-enreg[XSB] addr-exposed "Inlining Arg"

-;  TEMP_01                                   byref  ->  [fp+0x10]
+;  TEMP_01                                   byref  ->  [fp-0x2428]

- ldrh    w11, [fp,#0xd1ffab1e]      // [V285 tmp284]
+ movn    xip1, #0xd1ffab1e
+ ldrh    w11, [fp, xip1]    // [V285 tmp284]

- str     x14, [fp,#16]      // [TEMP_01]
+ movn    xip1, #0xd1ffab1e
+ str     x14, [fp, xip1]    // [TEMP_01]

I noticed this while implementing stack probe helper support on Arm64 in #43250 when the JIT is required to store fp,lr register pair earlier during prolog execution to be able to call a helper.

@dotnet/jit-contrib

category:cq
theme:register-allocator

@echesakov echesakov added arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI labels Feb 3, 2021
@echesakov echesakov added this to the 6.0.0 milestone Feb 3, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Feb 3, 2021
@echesakov echesakov removed the untriaged New issue has not been triaged by the area owner label Feb 3, 2021
@JulieLeeMSFT JulieLeeMSFT added needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration and removed needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration labels Mar 23, 2021
@JulieLeeMSFT JulieLeeMSFT modified the milestones: 6.0.0, Future Mar 29, 2021
@JulieLeeMSFT JulieLeeMSFT added the Priority:2 Work that is important, but not critical for the release label Mar 29, 2021
@echesakov
Copy link
Contributor Author

Un-assigning myself
cc @BruceForstall

@echesakov echesakov removed their assignment Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI optimization Priority:2 Work that is important, but not critical for the release
Projects
Status: Optimizations
Development

No branches or pull requests

3 participants