Skip to content

Optimizer: support partial_apply of thunks in the copy_block simplification #81253

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 3 commits into from
May 5, 2025

Conversation

eeckstein
Copy link
Contributor

If the block is passed to another function - either as closure argument or as closure capture - it's "converted" to a swift closure with the help of a thunk. The thunk just calls the block.
If this is done with a non-escaping partial_apply, the block does not escape.

This is a follow-up of #80819

rdar://149095630

eeckstein added 3 commits May 2, 2025 18:07
…unchecked_ownership_conversion`

The optimizer may convert unowned blocks to guaranteed blocks for a partial_apply. This does not require any scope-ending instructions.
…fication.

If the block is passed to another function - either as closure argument or as closure capture - it's "converted" to a swift closure with the help of a thunk. The thunk just calls the block.
If this is done with a non-escaping partial_apply, the block does not escape.

rdar://149095630
@eeckstein eeckstein requested a review from jckarter as a code owner May 2, 2025 16:15
@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein eeckstein merged commit fba1f1d into swiftlang:main May 5, 2025
5 checks passed
@eeckstein eeckstein deleted the copy-block-opt2 branch May 5, 2025 05:40
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.

1 participant