JIT: remove dead BBJ_RETURN-in-loop assertion in loop cloner#128791
Open
AndyAyersMS wants to merge 1 commit into
Open
JIT: remove dead BBJ_RETURN-in-loop assertion in loop cloner#128791AndyAyersMS wants to merge 1 commit into
AndyAyersMS wants to merge 1 commit into
Conversation
optIsLoopClonable contained a DEBUG-only walk that asserted no block in the loop was BBJ_RETURN, plus a stale function comment claiming that fgReturnCount would be bumped on success. There is no code anywhere in loopcloning.cpp that adjusts fgReturnCount (verified by grep), and the assertion is redundant: natural loops in RyuJIT can never contain a BBJ_RETURN block, because FlowGraphNaturalLoop discovery uses only regular CFG back-edges and BBJ_RETURN has no successor that can flow back to a loop header. Verified empirically across 23,712 natural loops from the benchmarks.run_pgo.windows SPMI collection (Tier1 + Tier1-OSR + FullOpts + Tier0-FullOpts, clonable + unclonable) — zero loops contained any BBJ_RETURN block. Drop both the assertion and the stale comment. No behavior change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
Author
|
@jakobbotsch PTAL |
Contributor
There was a problem hiding this comment.
Pull request overview
Removes a stale comment about fgReturnCount and a DEBUG-only assertion that no loop block is BBJ_RETURN from optIsLoopClonable. With EH-loop cloning now enabled by default, BBJ_RETURN blocks can legitimately appear in cloneable loops, and the surrounding context (fgReturnCount is never updated here) makes the comment misleading.
Changes:
- Drop stale
fgReturnCountnote fromoptIsLoopClonableheader comment. - Remove DEBUG
VisitLoopBlocksassertion that rejectedBBJ_RETURNblocks.
jakobbotsch
approved these changes
May 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Loops no longer have returns, so remove some stale comments and checks.