-
Notifications
You must be signed in to change notification settings - Fork 10.5k
LifetimeDependence: simplify and fix multiple bugs #79236
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@swift-ci test |
6a7b589
to
389987a
Compare
@swift-ci test |
The test failure is not related to this PR:
It should be fixed here: #79239 |
@swift-ci smoke test macOS |
389987a
to
8421608
Compare
@swift-ci test |
8421608
to
f066872
Compare
@swift-ci test |
@swift-ci Please Build Toolchain macOS Platform |
Consider end_lifetime to be part of the endOperands set, which is used for linear liveness, even though it does not end the lifetime.
A simple utility on ForwardingInstructions that should be defined alongside similar utilities rather than inside a pass.
General utility to determine whether an argument already has an access scope that is compatibly with this BeginAccess.
Avoid bailing out when something depends on the local variable.
Return an Initializer rather than a tuple. This makes it easier and more robust for clients to track dependencies on initialized memory.
Functional changes: Improved modeling of dependence on local variable scopes. For nested modify->read accesses, only extend the read accesses. Avoid making a read access dependent on an inout argument. The following needs to be an error to prevent span storage from being modified: @Lifetime(owner) foo(owner: inout Owner) -> Span { owner.span } Improve usability of borrowing trivial values (UnsafePointer). Allow: let span = Span(buffer.baseAddress) Ignore access scopes for trivial values. Structural changes: Delete the LifetimeDependenceUseDefWalker. Encapsulate all logic for variable introducers within the LifetimeDependenceInsertion pass. Once mark_dependence instructions are inserted, no subsequent pass needs to think about the "root" of a dependence. Fixes: rdar://142451725 (Escape analysis fails with mutations)
This fixes functions that return @Lifetime(immortal).
Needed to diagnose MutableSpan and OutputSpan. For now, simply remove the bailout and TODO. The next change will introduce more logic to force a diagnostic error in rare cases that can't be handled completely. Fixes rdar://143584461 (Extended exclusive borrow issues with MutableSpan and OutputSpan)
f066872
to
c2842e8
Compare
@swift-ci smoke test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Functional changes:
Improved modeling of dependence on local variable scopes.
Support for global 'let' dependencies
For nested modify->read accesses, only extend the read accesses.
Avoid making a read access dependent on an inout argument.
The following needs to be an error to prevent span storage from being modified:
@Lifetime(owner)
foo(owner: inout Owner) -> Span {
owner.span
}
Improve usability of borrowing trivial values (UnsafePointer). Allow:
let span = Span(buffer.baseAddress)
Ignore access scopes for trivial values.
Structural changes:
Delete the LifetimeDependenceUseDefWalker. The major commit in this PR deletes 120 lines of code. The added lines in the other commits are mostly tests.
Encapsulate all logic for variable introducers within the LifetimeDependenceInsertion pass. Once mark_dependence instructions are inserted, no subsequent pass needs to think about the "root" of a dependence.
Fixes: rdar://142451725 (Escape analysis fails with mutations)
Fixes rdar://143584461 (Extended exclusive borrow issues with MutableSpan and OutputSpan)