-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[6.0] Fix lifetime dependence in the presence of pointer escapes. #72597
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
atrick
merged 16 commits into
swiftlang:release/6.0
from
atrick:60-pointer-escape-bailout
Mar 27, 2024
Merged
[6.0] Fix lifetime dependence in the presence of pointer escapes. #72597
atrick
merged 16 commits into
swiftlang:release/6.0
from
atrick:60-pointer-escape-bailout
Mar 27, 2024
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
(cherry picked from commit 6b3d62c)
Add PartialApplyInst.hasNoescapeCapture Add PartialApplyInst.mayEscape Refactor DiagnoseInvalidEscapingCaptures. This may change functionality because tuples containing a noescape closure are now correctly recognized. Although I'm not sure such tupes can ever be captured directly. (cherry picked from commit aa208bb)
To fix LifetimeDependenceScopeFixup in the presense of pointer escapes. (cherry picked from commit bdabc21)
(cherry picked from commit 95a100a)
(cherry picked from commit 5e9e282)
(cherry picked from commit ff14633)
(cherry picked from commit 009bc58)
(cherry picked from commit b7eaee9)
(cherry picked from commit 352724e)
(cherry picked from commit 00fbf4f)
(cherry picked from commit 73e28df)
Fixes rdar://124564951 (Compiler crash when evaluating pointer escape in autoclosure; LifetimeDepenenceScopeFixup; Fatal error: check findPointerEscape() before computing interior liveness.) (cherry picked from commit f1fbbcd)
(cherry picked from commit e77fff3)
It is safe to do so because the on_stack transformation already checks that the closure has a single known apply use. (cherry picked from commit 2e82db8)
Treat mark_dependence [nonescaping] as a dependent value even if the dependence base does not have a recognizable scope (e.g. a multiply-defined alloc_stack). This happens because ClosureLifetimeFixup creates redundant mark_dependence instructions for partial_apply captures. We constantly need to work around this broken representation of nonescaping closures. (cherry picked from commit 3e7d9db)
(cherry picked from commit 5032cf4)
@swift-ci test |
tbkka
approved these changes
Mar 26, 2024
meg-gupta
approved these changes
Mar 26, 2024
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.
--- CCC ---
Explanation: Fix lifetime dependence in the presence of pointer escapes.
Scope: This fixes common patterns exposed by generic ~Escapable types.
Radar/SR Issue: rdar://124564951 (Compiler crash when evaluating pointer escape in autoclosure; LifetimeDepenenceScopeFixup; Fatal error: check findPointerEscape() before computing interior liveness.)
Original PR: #72407
Risk: Changes the SIL representation of closure captures by adding a flag. This could expose bugs in downstream passes. This risk is mitigated in a subsequent PR: #72513
Testing: Unit tests added.
Reviewer: @meg-gupta