-
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
Loop opts should not be recomputing pred lists from scratch #49030
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
See notes in #48850 for some context. |
We used to always need to rebuild pred lists after renumbering blocks due to pred list ordering being dependent on block number, so presumably phases knew they could be sloppy and things would get cleaned up later. But with the new Maybe we need a pred list checker that runs |
I get post-phase check failures about missing preds if I remove the call to The missing jump target flags might be harder to track down; it's not clear if we have agreement about when the jump target bit needs to be set, and we don't seem to check this post phase. It is checked in codegen. |
I'm thinking we should get rid of |
Sounds good to me. |
|
Instead, add and modify the appropriate preds when the mechanical cloning is performed. This will preserve existing profile data on the edges. Contributes to dotnet#49030 No x86/x64 SPMI asm diffs.
Instead, add and modify the appropriate preds when the mechanical cloning is performed. This will preserve existing profile data on the edges. Contributes to #49030 No x86/x64 SPMI asm diffs.
@BruceForstall Please link this issue with your Loop Optimization user story #43549. |
Loop cloning stopped recomputing preds lists after optimization with #51757 |
Remaining phases calling
|
We now update pred lists during loop unrolling, rather than recomputing them from scratch. There are several parts to the fix: first, `optRedirectBlock' now has a new ability to add pred references for the flow from a newly cloned block, be it either to a remapped successor or a non-remapped successor. Along with this we no longer copy over the block ref count in `CloneBlockState`. These changes allow us to create the right pred links and ref counts in the interior of a cloned subgraph. Second, we now scrub block references from the original loop body blocks instead of just setting their ref counts to zero. Finally, we fix up references for exterior flow into and out of the unroll complex. Addresses one of the cases mentioned in dotnet#49030.
We now update pred lists during loop unrolling, rather than recomputing them from scratch. There are several parts to the fix: first, `optRedirectBlock' now has a new ability to add pred references for the flow from a newly cloned block, be it either to a remapped successor or a non-remapped successor. Along with this we no longer copy over the block ref count in `CloneBlockState`. These changes allow us to create the right pred links and ref counts in the interior of a cloned subgraph. Second, we now scrub block references from the original loop body blocks instead of just setting their ref counts to zero. Finally, we fix up references for exterior flow into and out of the unroll complex. Addresses one of the cases mentioned in #49030.
Loop canonicalization now maintains pred edges. GC poll insertion was already maintaining the edges but was rebuilding them anyways. Now pred lists are never rebuilt. Also revise `fgUpdateChangedFlowGraph` so that it no longer has the ability to remove or rebuild. Fixes dotnet#49030.
Loop canonicalization now maintains pred edges. GC poll insertion was already maintaining the edges but was rebuilding them anyways. Now pred lists are never rebuilt. Also revise `fgUpdateChangedFlowGraph` so that it no longer has the ability to remove or rebuild. Fixes dotnet#49030. Also fixes dotnet#80772.
Several loop opts end up calling
fgUpdateChangedFlowGraph
when done, and this callsfgComputePreds
, leaking previous pred lists and losing the profile weights carefully calculated earlier.This seems wrong-headed; I think those optimizations should maintain pred lists and not rebuild them.
Removing the call to
fgComputePreds
shows a number of places in loop opts where pred lists are not properly updated, and more downstream failures from places unknown whereBBF_JMP_TARGET
is not properly set, so cleaning this up may be nontrivial.category:cq
theme:loop-opt
skill-level:expert
cost:medium
impact:medium
The text was updated successfully, but these errors were encountered: