Skip to content

6.1: [DCE] Don't complete lifetimes of erased values. #78319

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

nate-chandler
Copy link
Contributor

@nate-chandler nate-chandler commented Dec 20, 2024

Explanation: Fix assertion failure during DCE.

DCE uses lifetime completion to end the lifetimes of values whose lifetime ending uses were deleted. Completion is done for all such values after all deletion has been done.

It is possible, however, for a value to be enqueued for eventual completion and then for the instruction which defines that value to be deleted. In that case, lifetime completion must not be run.

Here, whenever an instruction is deleted, all of its results are removed from the collection of values whose lifetimes are to be completed.
Scope: Affects optimized code.
Issue: rdar://141560546
Original PR: #78306
Risk: Low.
Testing: Added test.
Reviewer: Erik Eckstein ( @eeckstein )

…etion

Lifetime completion will insert end_borrows only on borrow introducers.

Look through "borrowed from" instructions before calling it.

rdar://141490551
@nate-chandler nate-chandler marked this pull request as ready for review December 20, 2024 15:51
@nate-chandler nate-chandler requested a review from a team as a code owner December 20, 2024 15:51
Rather than reusing the source of the dyn_cast.
Set CallsChanged when appropriate and increment NumDeletedInsts.
DCE may enqueue a value for lifetime completion and later on erase the
instruction that defines that value.  When erasing an instruction, erase
each of its results from the collection of values to complete.

rdar://141560546
On main type annotations are not always required but on 6.1 they are.
@nate-chandler nate-chandler force-pushed the cherrypick/release/6.1/rdar141560546 branch from c14d36f to 9bc4a9b Compare December 20, 2024 17:16
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler nate-chandler merged commit bc16701 into swiftlang:release/6.1 Dec 20, 2024
5 checks passed
@nate-chandler nate-chandler deleted the cherrypick/release/6.1/rdar141560546 branch December 20, 2024 22:58
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.

3 participants