Skip to content

[6.1] Fix DCE for ownership forwarding instructions #78063

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 2 commits into from
Dec 11, 2024

Conversation

meg-gupta
Copy link
Contributor

Explanation: DCE deletes ownership forwarding instructions when it doesn’t have useful users. It inserts destroy_value/end_borrow for its operands to compensate their lifetimes.

DCE also deletes branches when its successor blocks does not have useful instructions. It deletes blocks and creates a jump to the nearest post dominating block.

When DCE needs to delete a forwarding instruction in a dead block, it cannot just create lifetime ends of its operands at its position. Use LifetimeCompletion utility in such cases.

Scope: Affects DCE running on ownership ssa

Risk: Medium.

Testing: Swift CI testing

Reviewed by: @nate-chandler

Original PR: #78053

rdar://140428721

@meg-gupta meg-gupta requested a review from a team as a code owner December 9, 2024 18:06
@meg-gupta meg-gupta changed the title Fix DCE for ownership forwarding instructions [6.1] Fix DCE for ownership forwarding instructions Dec 9, 2024
@meg-gupta
Copy link
Contributor Author

@swift-ci test

DCE deletes ownership forwarding instructions when it doesn’t have useful users.
It inserts destroy_value/end_borrow for its operands to compensate their lifetimes.

DCE also deletes branches when its successor blocks does not have useful instructions.
It deletes blocks and creates a jump to the nearest post dominating block.

When DCE needs to delete a forwarding instruction in a dead block, it cannot just create
lifetime ends of its operands at its position. Use LifetimeCompletion utility in such cases.

rdar://140428721
@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta meg-gupta enabled auto-merge December 10, 2024 00:43
@meg-gupta
Copy link
Contributor Author

@swift-ci smoke test macOS Platform

@meg-gupta
Copy link
Contributor Author

@swift-ci test macOS Platform

@meg-gupta meg-gupta merged commit 879ff13 into swiftlang:release/6.1 Dec 11, 2024
5 checks passed
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.

2 participants