Skip to content

Lower GT_RETURN_SUSPEND blocks to BBJ_RETURN#124177

Merged
jakobbotsch merged 3 commits intodotnet:mainfrom
jakobbotsch:fix-124162
Feb 10, 2026
Merged

Lower GT_RETURN_SUSPEND blocks to BBJ_RETURN#124177
jakobbotsch merged 3 commits intodotnet:mainfrom
jakobbotsch:fix-124162

Conversation

@jakobbotsch
Copy link
Member

When the AsyncSuspend intrinsic is used we can end up with GT_RETURN_SUSPEND present in a block that is not BBJ_RETURN. That would happen for instance because of return merging due to ELT profiler hooks.

Expand the lowering for this node to convert the block containing GT_RETURN_SUSPEND into a BBJ_RETURN block.

Fix #124162

When the AsyncSuspend intrinsic is used we can end up with
GT_RETURN_SUSPEND present in a block that is not `BBJ_RETURN`. That
would happen for instance because of return merging due to ELT profiler
hooks.

Expand the lowering for this node to convert the block containing
`GT_RETURN_SUSPEND` into a `BBJ_RETURN` block.
Copilot AI review requested due to automatic review settings February 9, 2026 14:16
@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 Feb 9, 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 updates JIT lowering to ensure blocks containing GT_RETURN_SUSPEND are properly treated as BBJ_RETURN blocks, addressing cases where return merging (e.g., due to ELT profiler hooks) can leave GT_RETURN_SUSPEND in a non-return block and break downstream assumptions.

Changes:

  • Extend Lowering::LowerReturnSuspend to scrub successor predecessor links and convert the containing block to BBJ_RETURN.
  • Adjust successor profile weights when removing outgoing flow and mark PGO data inconsistent when propagation would be required.
  • Invalidate DFS tree after modifying control flow.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 9, 2026 14:40
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 1 out of 1 changed files in this pull request and generated no new comments.

@jakobbotsch
Copy link
Member Author

/azp run runtime-coreclr superpmi-diffs

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jakobbotsch jakobbotsch marked this pull request as ready for review February 10, 2026 18:02
Copilot AI review requested due to automatic review settings February 10, 2026 18:02
@jakobbotsch
Copy link
Member Author

PTAL @dotnet/jit-contrib

@jakobbotsch jakobbotsch requested a review from a team February 10, 2026 18:08
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 1 out of 1 changed files in this pull request and generated no new comments.

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.

Test failure: async/valuetask-source/valuetask-source/valuetask-source.cmd

3 participants