-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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: Use post order computed by SSA in VN #94623
Conversation
VN tries hard to dynamically compute a reverse post-order to visit the flow graph in. However, SSA has already computed such an order, so simply pass this along to VN instead. A few positive diffs are expected. As Andy has pointed out recently the "dynamic RPO" VN was doing does not necessarily result in an actual RPO, so using SSA's order is expected to be a better order than what VN ends up with today.
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsVN tries hard to dynamically compute a reverse post-order to visit the flow graph in. However, SSA has already computed such an order, so simply pass this along to VN instead. A few positive diffs are expected. As Andy has pointed out recently the "dynamic RPO" VN was doing does not necessarily result in an actual RPO, so using SSA's order is expected to be a better order than what VN ends up with today.
|
@@ -769,7 +769,6 @@ bool Compiler::fgRemoveDeadBlocks() | |||
// Notes: | |||
// Each block's `bbPreorderNum` and `bbPostorderNum` is set. | |||
// The `fgBBReversePostorder` array is filled in with the `BasicBlock*` in reverse post-order. | |||
// This algorithm only pays attention to the actual blocks. It ignores any imaginary entry block. |
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.
I wasn't totally sure what this was referring to... but today we do ensure all blocks are visited below, so it seemed odd.
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.
SSA creates a stack-allocated BB0 when it computes dominators, I suspect this is the "imaginary entry block."
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.
Hmm, might be. Still, not sure it is too relevant for this computation.
/azp run runtime-coreclr jitstress, runtime-coreclr libraries-jitstress, Fuzzlyn |
Azure Pipelines successfully started running 3 pipeline(s). |
cc @dotnet/jit-contrib PTAL @AndyAyersMS Some minor positive diffs, both in codegen and TP. |
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.
Nice.
We should think about how to safeguard against flowgraph changes... doesn't have to be in this PR but maybe you could use the bracketing "is safe to add" stuff I used when doing something similar for morph.
Good idea, will think about how to reuse that. |
Possibly related improvement: dotnet/perf-autofiling-issues#24588. |
VN tries hard to dynamically compute a reverse post-order to visit the flow graph in. However, SSA has already computed such an order, so simply pass this along to VN instead.
A few positive diffs are expected. As Andy has pointed out recently the "dynamic RPO" VN was doing does not necessarily result in an actual RPO, so using SSA's order is expected to be a better order than what VN ends up with today.