Skip to content

JIT: recompute exit weight in loop inversion - #131362

Merged
AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:fix-131329
Jul 27, 2026
Merged

JIT: recompute exit weight in loop inversion#131362
AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:fix-131329

Conversation

@AndyAyersMS

Copy link
Copy Markdown
Member

Avoids amplifying pre-existing small profile inconsistencies once the loop-exit flow is scaled down.

Fixes #131329.

Avoids amplifying pre-existing small profile inconsistencies once the
loop-exit flow is scaled down.

Fixes dotnet#131329.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 25, 2026 01:42
@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 25, 2026
@AndyAyersMS
AndyAyersMS requested a review from jakobbotsch July 25, 2026 01:42
@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.

@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 adjusts how loop inversion updates profile weights in optTryInvertWhileLoop to avoid profile self-consistency failures after the transformation.

Changes:

  • Stops adjusting the loop-exit block weight via subtraction of the newly introduced edge weight.
  • Recomputes the loop-exit block weight from its incoming edges after the duplicated blocks’ weights are updated.

Comment thread src/coreclr/jit/optimizer.cpp
@AndyAyersMS
AndyAyersMS merged commit 2177d80 into dotnet:main Jul 27, 2026
138 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc1 milestone Jul 28, 2026
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.

Assertion failed '!"Inconsistent profile data"' in 'System.Number:DiyFp128Exp(byref):System.Number+DiyFp128' during 'Invert loops'

3 participants