-
Notifications
You must be signed in to change notification settings - Fork 10.6k
LifetimeDependenceDiagnostics: extend temp alloc to unreachable. #84641
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
@swift-ci test |
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 - I added another test suggestion. So far, I thought we don't disable dealloc_stack emission on unreachable paths.
@meg-gupta yes, omitting dealloc_stack is very problematic for computing the scope of address dependencies. It would be much simpler to enforce a dealloc on all paths. @eeckstein @nate-chandler technically this is not required by OSSA but it requires a very similar CFG analysis of lifetime end points and it's strange to complete lifetimes without also completing allocations. |
Neither lifetimes of values nor "lifetimes" of alloc_stacks are currently complete throughout the pipeline, so such completeness cannot be relied on. But I agree that it may make sense to complete of the former when completing of the latter. |
@swift-ci smoke test |
@swift-ci smoke test |
ac9a5b6
to
3469879
Compare
When a non-Escapable value depends on the address of a trivial value, we use a special computeAddressableRange analysis to compute the trivial value's scope. Extend that analysis to include unreachable paths. Fixes this pattern: inlineStorage.span.withUnsafeBytes where inlineStorage is a trivial type defined in the user module. This does not reproduce directly with InlineArray, but it is a problem for user modules that have their own trivial wrapper around an InlineArray. Fixes rdar://161630684 (Incorrect diagnostic: lifetime-dependent value escapes its scope)
3469879
to
bed80ee
Compare
@swift-ci smoke test |
@swift-ci smoke test linux |
1 similar comment
@swift-ci smoke test linux |
When a non-Escapable value depends on the address of a trivial value, we use a
special computeAddressableRange analysis to compute the trivial value's
scope. Extend that analysis to include unreachable paths.
Fixes this pattern:
where inlineStorage is a trivial type defined in the user module. This
does not reproduce directly with InlineArray, but it is a problem for
user modules that have their own trivial wrapper around an InlineArray.
Fixes rdar://161630684 (Incorrect diagnostic: error: lifetime-dependent value escapes its scope)