Skip to content

Re-order some blocks in runtimelookup #83453

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

Closed
wants to merge 8 commits into from

Conversation

EgorBo
Copy link
Member

@EgorBo EgorBo commented Mar 15, 2023

Motivation: #83430 (comment) let's see the diffs. #83430 changes JIT-EE guid so can't see diffs there

@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Mar 15, 2023
@ghost ghost assigned EgorBo Mar 15, 2023
@ghost
Copy link

ghost commented Mar 15, 2023

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

Issue Details

Motivation: #83430 (comment)

Author: EgorBo
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@EgorBo
Copy link
Member Author

EgorBo commented Mar 15, 2023

Comment on lines -415 to -458
if (result == PhaseStatus::MODIFIED_EVERYTHING)
{
if (opts.OptimizationEnabled())
{
fgReorderBlocks(/* useProfileData */ false);
fgUpdateChangedFlowGraph(FlowGraphUpdates::COMPUTE_BASICS);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

W.r.t. the confusing diffs, maybe try with this change reverted?

nullcheckBb->bbJumpDest = fallbackBb;
fastPathBb->bbJumpDest = block;
nullcheckBb->bbJumpDest = fastPathBb;
fallbackBb->bbJumpDest = block;
Copy link
Member

@kunalspathak kunalspathak Mar 28, 2023

Choose a reason for hiding this comment

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

What if you mark fallBackBb->bbSetRunRarely()? I had to do similar thing to re-arrange in #80297.

Copy link
Member

Choose a reason for hiding this comment

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

G_M10050_IG01:
       sub      rsp, 40
                                                ;; size=4 bbWeight=1 PerfScore 0.25
G_M10050_IG02:
       mov      rcx, qword ptr GS:[0x0058]
       mov      rcx, qword ptr [rcx+30H]
       mov      edx, dword ptr [rcx+48H]
       cmp      edx, 2
       jl       SHORT G_M10050_IG04
                                                ;; size=21 bbWeight=1 PerfScore 6.25
G_M10050_IG03:
       mov      rcx, qword ptr [rcx+50H]
       cmp      qword ptr [rcx+10H], 0
       jne      SHORT G_M10050_IG05
                                                ;; size=11 bbWeight=0.90 PerfScore 5.42
G_M10050_IG04:
       mov      rcx, 0xD1FFAB1E
       mov      edx, 29
       mov      r8d, 2
       call     CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE_NOCTOR_OPTIMIZED
       mov      qword ptr [rsp+20H], rax
                                                ;; size=31 bbWeight=0.09 PerfScore 0.25
G_M10050_IG05:
       mov      rax, qword ptr [rsp+20H]
       mov      eax, dword ptr [rax+8CH]
                                                ;; size=11 bbWeight=1 PerfScore 3.00
G_M10050_IG06:
       add      rsp, 40
       ret
                                                ;; size=5 bbWeight=1 PerfScore 1.25

vs.

G_M10050_IG01:
       sub      rsp, 40
                                                ;; size=4 bbWeight=1 PerfScore 0.25
G_M10050_IG02:
       mov      rax, qword ptr GS:[0x0058]
       mov      rax, qword ptr [rax+30H]
       mov      ecx, dword ptr [rax+48H]
       cmp      ecx, 2
       jl       SHORT G_M10050_IG06
                                                ;; size=21 bbWeight=1 PerfScore 6.25
G_M10050_IG03:
       mov      rax, qword ptr [rax+50H]
       cmp      qword ptr [rax+10H], 0
       je       SHORT G_M10050_IG06
                                                ;; size=11 bbWeight=0.90 PerfScore 5.42
G_M10050_IG04:
       mov      r9, qword ptr [rsp+20H]
       mov      eax, dword ptr [r9+8CH]
                                                ;; size=12 bbWeight=1 PerfScore 3.00
G_M10050_IG05:
       add      rsp, 40
       ret
                                                ;; size=5 bbWeight=1 PerfScore 1.25
G_M10050_IG06:
       mov      rcx, 0xD1FFAB1E
       mov      edx, 29
       mov      r8d, 2
       call     CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE_NOCTOR_OPTIMIZED
       mov      r9, rax
       mov      qword ptr [rsp+20H], r9
       jmp      SHORT G_M10050_IG04
                                                ;; size=36 bbWeight=0 PerfScore 0.00

@EgorBo EgorBo closed this Apr 14, 2023
@ghost ghost locked as resolved and limited conversation to collaborators May 14, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants