Skip to content

Conversation

@jakobbotsch
Copy link
Member

Fix #121691

Copilot AI review requested due to automatic review settings January 5, 2026 10:46
@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 Jan 5, 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 addresses issue #121691 by detecting degenerate switches in the JIT's switch recognition phase. A degenerate switch occurs when all test paths lead to the same target block, meaning there's only one unique successor instead of two.

Key Changes:

  • Dynamically calculates the number of unique successors based on whether blockIfTrue equals blockIfFalse
  • Updates the BBswtDesc constructor call to use the computed numSuccs value instead of a hardcoded 2

@jakobbotsch
Copy link
Member Author

cc @dotnet/jit-contrib PTAL @EgorBo

@jakobbotsch jakobbotsch requested a review from EgorBo January 5, 2026 12:42
Copy link
Member

@EgorBo EgorBo left a comment

Choose a reason for hiding this comment

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

presumably if all successors target the same block we can remove the switch entirely, but I guess here it's just some stress artifact

@jakobbotsch
Copy link
Member Author

presumably if all successors target the same block we can remove the switch entirely, but I guess here it's just some stress artifact

No, this actually happens in real code. But we have a later flowgraph optimization that removes the switch, so I didn't bother doing anything more complicated here.

@jakobbotsch
Copy link
Member Author

/ba-g iOS deadletter

@jakobbotsch jakobbotsch merged commit 8972410 into dotnet:main Jan 5, 2026
126 of 129 checks passed
@jakobbotsch jakobbotsch deleted the fix-121691 branch January 5, 2026 15:58
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: JIT/superpmi/superpmicollect/superpmicollect.cmd

2 participants