6.1: [OSSACompleteLifetime] Recurse into scoped addresses. #78207
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.
Explanation: Fix lifetime completion of scoped addresses.
In #78081 , support for completing lifetimes of scoped addresses (
store_borrow
,begin_access
) was added. That support relied on theScopedAddressValue::computeTransitiveLiveness
function, however. That function does not actually produce liveness that includes all transitive uses: specifically, it doesn't include theend_borrow
s ofload_borrow
s. The result was that lifetimes of scoped addresses would be ended before the lifetimes ofload_borrow
s that they enclose, which is invalid.Here, this is fixed by writing a variation of
computeTransitiveLiveness
's calleefindTransitiveUsesForAddress
. Like the latter, the new variation (written directly inOSSALifetimeCompletion
) uses aTransitiveAddressWalker
. Unlike it, however, it includes theend_borrow
s ofload_borrow
s.Additionally, the new walker completes inner lifetimes that are discovered while visiting the transitive uses of the scoped address. That brings this case into parity with what's done when completing lifetimes for values.
Scope: Affects optimized code.
Issue: rdar://141246601
Original PR: #78180
Risk: Low.
Testing: Added test.
Reviewer: Meghana Gupta ( @meg-gupta )