Skip to content

JIT: don't let tail-merge try and remove the OSR-protected entry block - #131164

Merged
AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:fix-131056
Jul 22, 2026
Merged

AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:fix-131056

Conversation

@AndyAyersMS

Copy link
Copy Markdown
Member

Fixes #131056

Copilot AI review requested due to automatic review settings July 21, 2026 18:11
@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 Jul 21, 2026
@AndyAyersMS

Copy link
Copy Markdown
Member Author

@jakobbotsch PTAL
fyi @dotnet/jit-contrib @BoyBaykiller

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 5 pipeline(s).
11 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@AndyAyersMS
AndyAyersMS requested a review from jakobbotsch July 21, 2026 18:11
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 prevents fgHeadTailMerge from removing the OSR-protected original entry block (fgEntryBB) while it still has an artificial bbRefs increment applied during import. This avoids hitting fgRemoveBlock assertions that require removed blocks to have bbRefs == 0 and bbPreds == nullptr.

Changes:

  • Add an OSR-specific guard in tail-merge block removal to skip removing fgEntryBB while it is still tracked as the “original method entry”.
  • Add an explanatory comment documenting the OSR artificial bbRefs bump / unprotect sequence.

@AndyAyersMS AndyAyersMS added the Priority:1 Work that is critical for the release, but we could probably ship without label Jul 21, 2026
@BoyBaykiller

Copy link
Copy Markdown
Contributor

Thank you for the fix.
I didn't know you'd have to be so careful when removing blocks so the origional PR caused quite a few asserts so far.
And as far as I am concerned there could be more special cases that I am unaware of and could cause issues...

@JulieLeeMSFT

Copy link
Copy Markdown
Member

Rerunning failed build.

Comment thread src/coreclr/jit/fgopt.cpp Resolved

@jakobbotsch jakobbotsch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, feel free to ignore

@AndyAyersMS
AndyAyersMS merged commit e4960d8 into dotnet:main Jul 22, 2026
145 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc1 milestone Jul 24, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 23, 2026
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 Priority:1 Work that is critical for the release, but we could probably ship without

Projects

None yet

5 participants