Skip to content

Return false in PropagateNeverToRuntime for BBJ_THROW blocks #118280

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

Merged
merged 6 commits into from
Aug 7, 2025

Conversation

EgorBo
Copy link
Member

@EgorBo EgorBo commented Aug 1, 2025

Fixes #115918

Previously, in non-DynamicPGO scenarios if we fail to inline a callee in an always-throw block, we used to mark such methods as NoInlining which is not the right thing to do since due to #78386 all always-throw blocks only inline trivial (<=8 bytes of IL) calls.

Also, move existing logic to be inside PropagateNeverToRuntime (cleanup)

@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 Aug 1, 2025
Copy link
Contributor

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

@EgorBo
Copy link
Member Author

EgorBo commented Aug 1, 2025

@MihuBot

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.

Diffs seem pretty modest.

I think we should consider taking this for .NET 10.

@EgorBo EgorBo marked this pull request as ready for review August 6, 2025 20:22
@Copilot Copilot AI review requested due to automatic review settings August 6, 2025 20:22
Copy link
Contributor

@Copilot 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 fixes an issue where callee methods in always-throw blocks were incorrectly being marked as NoInlining when inlining failed. The fix ensures that for BBJ_THROW blocks, the system returns false from PropagateNeverToRuntime, preventing the inappropriate marking. Additionally, the PR consolidates related logic by moving the dynamic PGO and other checks into the PropagateNeverToRuntime method.

Key changes:

  • Return false in PropagateNeverToRuntime for BBJ_THROW blocks to prevent incorrect NoInlining marks
  • Consolidate inline propagation logic by moving dynamic PGO checks from InlineResult::Report() to PropagateNeverToRuntime
  • Simplify the reporting logic in InlineResult::Report() by removing duplicated conditions

Reviewed Changes

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

File Description
src/coreclr/jit/inlinepolicy.cpp Refactored PropagateNeverToRuntime to handle BBJ_THROW blocks and consolidated dynamic PGO logic
src/coreclr/jit/inline.cpp Simplified InlineResult::Report() by removing logic moved to PropagateNeverToRuntime

@EgorBo
Copy link
Member Author

EgorBo commented Aug 6, 2025

@AndyAyersMS then this is ready for review I guess? With this commit I've checked that the diffs are triggered only by this if (m_InsideThrowBlock) check, the rest of the changes are just refactoring to move logic to be inside DefaultPolicy::PropagateNeverToRuntime

@EgorBo EgorBo requested a review from AndyAyersMS August 6, 2025 20:53
@EgorBo EgorBo merged commit f1be1df into dotnet:main Aug 7, 2025
103 of 105 checks passed
@EgorBo EgorBo deleted the fix-PropagateNeverToRuntime branch August 7, 2025 12:39
@EgorBo EgorBo added this to the 10.0.0 milestone Aug 7, 2025
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.

JIT: Cold code inlining decisions are incorrectly used later
2 participants