Skip to content

[OpaqueValues] Handle Builtin.copy. #61879

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

Conversation

nate-chandler
Copy link
Contributor

Based on #61846 .

Specify the operand ownership of the Builtin differently depending on whether lowered addresses are used. Handle rewriting the value version of the builtin as the address version of the builtin in AddressLowering.

Previously the API was only on FullApplySite, but it is useful to be
able to insert code after a partial_apply as well.
Rather than being able to handle only to FullApplySites, it now handles
PartialApplyInsts as well.
Use the CallArgRewriter to rewrite uses by partial_apply insts just as
uses by apply insts, etc., are rewritten.
When branching to the exit block, flatten an @out tuple return value
into its components, as is done for all other return values.

In the exit block, when constructing the @out tuple to return, visit the
tuple-type-tree of the return value to reconstruct the nested tuple
structure: @out tuple returns are not flattened, unlike regular tuple
returns.
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

Specify the operand ownership of the Builtin differently depending on
whether lowered addresses are used.  Handle rewriting the value version
of the builtin as the address version of the builtin in AddressLowering.
@nate-chandler nate-chandler force-pushed the opaque-values/1/20221101 branch from cb94d12 to e357fb4 Compare November 2, 2022 20:49
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler nate-chandler marked this pull request as ready for review November 3, 2022 15:18
@nate-chandler nate-chandler merged commit ce423f8 into swiftlang:main Nov 3, 2022
@atrick
Copy link
Contributor

atrick commented Nov 3, 2022

LGTM

Except, as I mentioned in two other PRs 😆, we should (in the not too distant future) remove Builtin.copy and all these special cases to handle it.

@nate-chandler nate-chandler deleted the opaque-values/1/20221101 branch July 5, 2023 23:33
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