Skip to content

[LifetimeCompletion] Avoid instruction list walk. #76095

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

Merged

Conversation

nate-chandler
Copy link
Contributor

When computing the available region, a forward walk is done from the non-lifetime-ending boundary of the live region. That boundary consists of (1) the target blocks of boundary edges, (2) dead defs, and (3) last users which are non-consuming. This forward walk is done at the block level, so neither the specific dead def (for (2)) nor specific last non-consuming user (for (3)) is required to perform the walk; indeed currently these are computed and then immediately used only to obtain the blocks in which they appear and then discarded. Avoid computing the specific dead defs and specific last non-consuming users by switching to a lower-fidelity liveness boundary computation via PrunedLivenessBlockBoundary.

Specifically, those pertaining to lifetime completion.
PrunedLiveness records users and their lifetime-ending-ness.  Make this
available to clients by way of a visitor.
To enable those clients which care only about _blocks_ whose
instructions or dead-defs make up the liveness boundary to avoid
iterating instruction lists, enhance boundary computation with a second
type (`PrunedLivenessBlockBoundary`) and migrate some methods from
liveness onto the boundary types to enable dispatching on the boundary
type to do only the amount of analysis that's necessary.
When computing the available region, a forward walk is done from the
non-lifetime-ending boundary of the live region.  That boundary consists
of (1) the target blocks of boundary edges, (2) dead defs, and (3) last
users which are non-consuming.  This forward walk is done at the block
level, so neither the specific dead def (for (2)) nor specific last
non-consuming user (for (3)) is required to perform the walk; indeed
currently these are computed and then immediately used only to obtain
the blocks in which they appear and then discarded.  Avoid computing the
specific dead defs and specific last non-consuming users by switching to
a lower-fidelity liveness boundary computation via
`PrunedLivenessBlockBoundary`.
Now that the compile time regressions observed in rdar://132552637 are
fixed, enable completion of lifetimes during the SILGenCleanup.
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler
Copy link
Contributor Author

@swift-ci please apple silicon benchmark

@nate-chandler
Copy link
Contributor Author

@swift-ci please test source compatibility

@nate-chandler
Copy link
Contributor Author

preset=buildbot_osx_package
@swift-ci Please test with preset macOS

@nate-chandler
Copy link
Contributor Author

preset=buildbot,tools=RA,stdlib=RDA,long_test
@swift-ci Please test with preset macOS

@nate-chandler nate-chandler requested a review from atrick August 27, 2024 14:11
@nate-chandler
Copy link
Contributor Author

preset=buildbot_incremental_linux,long_test
@swift-ci Please test with preset linux

@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler nate-chandler marked this pull request as ready for review August 30, 2024 14:09
@nate-chandler nate-chandler merged commit b3fd194 into swiftlang:main Aug 30, 2024
9 checks passed
@nate-chandler nate-chandler deleted the lifetime-completion/20240826/1 branch August 30, 2024 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant