Skip to content

Conversation

@MichalPetryka
Copy link
Contributor

Sets lvSingleDef for non TYP_REF locals, currently this should only affect reuse of RET_EXPR spills.

Split off from #85197.

@ghost ghost added area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI community-contribution Indicates that the PR has been added by a community member labels Apr 26, 2023
@ghost
Copy link

ghost commented Apr 26, 2023

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

Issue Details

Sets lvSingleDef for non TYP_REF locals, currently this should only affect reuse of RET_EXPR spills.

Split off from #85197.

Author: MichalPetryka
Assignees: -
Labels:

area-CodeGen-coreclr, community-contribution

Milestone: -

@MichalPetryka
Copy link
Contributor Author

Diffs are mostly moves being shuffled around and more places being affected by #85547.

Copy link
Member

@AndyAyersMS AndyAyersMS left a comment

Choose a reason for hiding this comment

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

Can you write up a summary of the diffs this causes? Make sure to include some of the ASP.NET regressions, eg:

Top method regressions (percentages):
          27 (18.88 % of base) : 24443.dasm - System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1+StateMachineBox`1[int,Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpRequestStream+<ReadAsyncInternal>d__30]:RentFromCache():System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1+StateMachineBox`1[int,Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpRequestStream+<ReadAsyncInternal>d__30]

@MichalPetryka
Copy link
Contributor Author

Can you write up a summary of the diffs this causes? Make sure to include some of the ASP.NET regressions, eg:

That specific one is caused by PGO marking a block as zero weight which blocks CSE, as per @SingleAccretion handling that would be tricky.
A fair bit of diffs are due to cmov conversion failing as per the mentioned issue.
And most diffs are due to the JIT using less variables so it emits less assigns from one var to another, leading to cascading diffs.

@jakobbotsch
Copy link
Member

A fair bit of diffs are due to cmov conversion failing as per the mentioned issue.

That issue is just the reason why it looks less efficient than it could be, but what is the reason that jump threading kicks in now but not before?

@MichalPetryka
Copy link
Contributor Author

but what is the reason that jump threading kicks in now but not before?

It's because inlinees now assign their returns directly to the variable in the method they're inlined to, instead of to a temp that's later assigned to the variable which I assume happend to block it.

@AndyAyersMS
Copy link
Member

but what is the reason that jump threading kicks in now but not before?

It's because inlinees now assign their returns directly to the variable in the method they're inlined to, instead of to a temp that's later assigned to the variable which I assume happend to block it.

Jump threading can't handle cases where the block to thread has side effects, so it could be by reusing a temp we're avoiding a temp to temp copy in an unfortunate spot.

Copy link
Member

@AndyAyersMS AndyAyersMS left a comment

Choose a reason for hiding this comment

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

Looks good to me now. Thanks!

@AndyAyersMS AndyAyersMS merged commit a193cb5 into dotnet:main May 1, 2023
@ghost ghost locked as resolved and limited conversation to collaborators May 31, 2023
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 community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants