Skip to content
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

Don't call fgMorphBlockStmt in LoopClonning #113558

Merged
merged 1 commit into from
Mar 15, 2025

Conversation

EgorBo
Copy link
Member

@EgorBo EgorBo commented Mar 14, 2025

Don't call fgMorphBlockStmt in loop clonning - morph might alter control flow (e.g. change BBJ_TRUE to BBJ_ALWAYS) and loop cloning doesn't expect that when it wires up blocks. It never happens today (we're lucky), but might be needed for Loop clonning for Spans (e.g. to fold localRef != null condition). Actually, we might hit it (in theory) for stack-allocated arrays as well 🤔

Also, I've removed the unreachable "multiple-conditions per block" code (it's when we merge multiple conditions into a single JTRUE with GT_AND) - I don't think we'll ever need it as the conditions that it creates are unfriendly for assertion propagation. It is more of a task for the late ifConversion phase.

I recommend reviewing the pr with

image

Expected to be zero-diff.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Mar 14, 2025
Copy link
Contributor

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

@EgorBo EgorBo marked this pull request as ready for review March 14, 2025 23:59
@Copilot Copilot bot review requested due to automatic review settings March 14, 2025 23:59
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.

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.


// Add jmpTrue "cond == 0"
GenTree* cond = conds[i].ToGenTree(comp, newBlk, /* invert */ true);
cond->gtFlags |= (GTF_RELOP_JMP_USED | GTF_DONT_CSE);
Copy link
Member Author

Choose a reason for hiding this comment

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

this is our regular routine for conditions inside JTRUE (fgMorphBlockStmt call used to set these flags for us).

@AndyAyersMS
Copy link
Member

Seems like another +1 for separating out the "optimization" parts of morph from its other duties.

@EgorBo
Copy link
Member Author

EgorBo commented Mar 15, 2025

PTAL @AndyAyersMS @BruceForstall @dotnet/jit-contrib

No diffs, the only ci failure is not related.

@EgorBo EgorBo merged commit 4ca1691 into dotnet:main Mar 15, 2025
114 checks passed
@EgorBo EgorBo deleted the cleanup-loop-clonning branch March 15, 2025 14:59
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.

None yet

2 participants