Skip to content

JIT: Share suspension epilogs in async transformation#125174

Draft
jakobbotsch wants to merge 4 commits intodotnet:mainfrom
jakobbotsch:shared-async-epilogs
Draft

JIT: Share suspension epilogs in async transformation#125174
jakobbotsch wants to merge 4 commits intodotnet:mainfrom
jakobbotsch:shared-async-epilogs

Conversation

@jakobbotsch
Copy link
Member

If we have more than one await, then create a shared GT_RETURN_SUSPEND block and use that for suspension always.

If we have more than one await, then create a shared `GT_RETURN_SUSPEND`
block and use that for suspension always.
Copilot AI review requested due to automatic review settings March 4, 2026 13:12
@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Mar 4, 2026
@dotnet-policy-service
Copy link
Contributor

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR changes the CoreCLR JIT async transformation to share a single GT_RETURN_SUSPEND “shared return” block when there are multiple awaits, so multiple suspension points can branch to one epilog.

Changes:

  • Refactors await discovery into FindAwaits(...), tracking normal vs tail-awaits and total await counts.
  • Transforms tail awaits in a first pass (TransformTailAwaits(...)) and re-scans when needed.
  • Introduces CreateSharedReturnBB() to create a shared GT_RETURN_SUSPEND block when #awaits > 1.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/coreclr/jit/async.h Adds declarations for await discovery, tail-await batch transform, and shared return block creation.
src/coreclr/jit/async.cpp Implements the refactor and shared return block creation, and updates tail-await suspension to use m_sharedReturnBB.

Copilot AI review requested due to automatic review settings March 4, 2026 13:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

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

Successfully merging this pull request may close these issues.

2 participants