-
Notifications
You must be signed in to change notification settings - Fork 5.1k
JIT: Modify switch and finally-ret successors using edge redirection helpers #117102
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
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this 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 refines switch successor updates by mutating existing edges and adding helpers to remove specific switch desc map entries, avoiding full invalidations. Key changes include:
- Replace full map invalidation with targeted edge removal in
LowerSwitch
. - Introduce
GetDescriptorForSwitchIfAvailable
andfgRemoveSuccFromSwitchDescMapEntry
to manage switch successor sets. - Refactor
fgReplaceEhfSuccessor
to usefgRedirectEdge
and a renamed removal helper for cleaner successor table updates.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/coreclr/jit/lower.cpp | Use fgRemoveSuccFromSwitchDescMapEntry when peeling off the default case and invalidate only when needed. |
src/coreclr/jit/fgflow.cpp | Add GetDescriptorForSwitchIfAvailable and fgRemoveSuccFromSwitchDescMapEntry ; deprecate global invalidation. |
src/coreclr/jit/fgbasic.cpp | Refactor fgReplaceEhfSuccessor to use edge redirection, rename fgRemoveEhfSuccessor , and optimize duplicate handling. |
src/coreclr/jit/compiler.h | Remove InvalidateUniqueSwitchSuccMap , declare new helpers, rename fgRemoveEhfSuccessor . |
cc @dotnet/jit-contrib, @AndyAyersMS PTAL. Small diffs from floating-point precision changes around edge weights. Thanks! |
Follow-up to #116933. By mutating the existing edge during switch successor modifications, we can avoid invalidating the unique switch successor map. Also adds a helper for removing edges from the switch successor map without needing to trash the whole entry. I'd like to get to a point where we always have accurate switch successor sets available -- we could even consider rearchitecting
BBswtDesc
to modelBBehfDesc
and hold unique successor edges.