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: Enable tail calls for mismatched return types (void) #111718

Open
EgorBo opened this issue Jan 22, 2025 · 1 comment
Open

JIT: Enable tail calls for mismatched return types (void) #111718

EgorBo opened this issue Jan 22, 2025 · 1 comment
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 Jan 22, 2025

Given that we see nice perf improvements when JIT emits more tail calls (presumably, due to CET) it might makes sense to enable more patterns, e.g. mismatched return types with void. Example:

int Test()
{
    // some code to make it non-inlineable without NoInlining attribute
    Console.WriteLine();
    Console.WriteLine();
    Console.WriteLine();
    Console.WriteLine();
    Console.WriteLine();
    Console.WriteLine();
    return 42;
}

void Bar()
{
    Test();
}

Current codegen:

; Method Benchmarks:Bar():this (FullOpts)
G_M18344_IG01:
       sub      rsp, 40
G_M18344_IG02:
       call     [Benchmarks:Test():int:this]
       nop      
G_M18344_IG03:
       add      rsp, 40
       ret      
; Total bytes of code: 16

Expected: Test is tail-called.

cc @jakobbotsch @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 Jan 22, 2025
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Jan 22, 2025
@EgorBo EgorBo added this to the Future milestone Jan 22, 2025
@EgorBo EgorBo removed the untriaged New issue has not been triaged by the area owner label Jan 22, 2025
Copy link
Contributor

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

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

1 participant