-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SILGenCleanup] Complete lifetimes of defs backwards reachable from dead-end blocks. #78105
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
37aaee9
to
15e5a26
Compare
15e5a26
to
37eadd5
Compare
@swift-ci please test |
@swift-ci please apple silicon benchmark |
@swift-ci please test source compatibility |
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!
Just some minor comments.
2fa5ce2
to
8fd1780
Compare
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.
lgtm!
Add a helper similar to findExitingBlocks.
In preparation for adding more users.
It was previously `isVisited`. And mark `visit` private, it needn't be part of the interface for any current clients.
Don't form a set of unreachable blocks, we only need to check whether any given block is unreachable, which can be done via `ReachableBlocks::isVisited`.
The method walks over the blocks of the function testing each for reachability and returns false on the first that is not.
Replace a SmallVector.
In preparation for completing lifetimes in multiple ranges (namely post-orders of subgraphs of the function), extract a complete-in-range method.
Enable clients to check whether the worklist has anything in it without popping a block to find out.
For a function to have complete lifetimes, the lifetime of every def in the function which is backwards-reachable from a dead-end block must be completed. Previously, every def in every block which appears in the post-order of the function's blocks is completed. This was not enough: defs in "unreachable blocks" (i.e. those which aren't forwards-reachable from the function entry) must be completed too, and such blocks do not appear in the function's post-order. Here, defs in unreachable blocks are be completed too. Such defs must also be completed in relative post-order. To do this, roots for the non-entry post-orders must be found. rdar://141197164
8fd1780
to
c327c59
Compare
@swift-ci please test |
@swift-ci please apple silicon benchmark |
@swift-ci please test source compatibility |
@swift-ci please test linux platform |
For a function to have complete lifetimes, the lifetime of every def in the function which is backwards-reachable from a dead-end block must be completed.
Previously, every def in every block which appears in the post-order of the function's blocks is completed. This was not enough: defs in "unreachable blocks" (i.e. those which aren't forwards-reachable from the function entry) must be completed too, and such blocks do not appear in the function's post-order.
Here, defs in unreachable blocks are be completed too. Such defs must also be completed in relative post-order. To do this, roots for the non-entry post-orders must be found.
rdar://141197164