-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
JIT: Remove bbFallsThrough check in optFindLoopCompactionInsertionPoint #99827
JIT: Remove bbFallsThrough check in optFindLoopCompactionInsertionPoint #99827
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
The more radical thing would be to stop doing loop compaction entirely. Now that we have a flow-based approach to finding loops, it should not matter what other blocks might appear between the lexically first and lexically last loop blocks. Whether we can "fix" this later though is likely the big question. Once we get to layout we will want to make loop bodies compact. |
I tried this locally out of curiosity, and the size/PerfScore regressions suggest our current layout algorithm doesn't handle uncompacted loops all that well. I've added a note to #93020 to consider skipping loop compaction once have a new layout algorithm, assuming the new algorithm does a decent job of placing loop bodies' blocks contiguously -- if we start with a RPO traversal, I guess that would negate the need for compaction? |
I believe that's the case, yes. |
I don't think RPO will guarantee compactness of natural loops -- for example, the RPO can have outside-loop successors of the exiting blocks between the header and its inside-loop successors. |
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.
Seems fine to me. I hope long term we remove the compaction entirely in favor of the block layout in the backend.
Calling
bbFallsThrough
isn't all that helpful here, as it doesn't considerBBJ_ALWAYS
blocks to the next block,BBJ_COND
blocks that don't fall through for the false path, etc. I'm planning on getting rid ofbbFallsThrough
everywhere except infgReorderBlocks
(that removal will hopefully come when we replace our block layout algorithm altogether), but to still be able to short-circuitoptFindLoopCompactionInsertionPoint
, I added some manual checks for blocks that can "fall through."cc @dotnet/jit-contrib, @jakobbotsch PTAL. The diffs weren't that big locally, but I'm open to different/more radical approaches here. Thanks!