[region-isolation] When assigning RValues into memory, use tuple_addr_constructor instead of doing it in pieces. #69686
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.
This PR contains 2 commits that create infrastructure and a final infrastructure that actually implements the subject of this radar. I did this to ease reviewing.
The purpose of this PR is that it ensures that diagnostic passes like TransferNonSendable can discern in between full assignments to tuples vs assignments to projects of the tuple. Before, SILGen would perform tuple assignment by performing it in pieces. This PR introduces a new instruction called tuple_addr_constructor that is equivalent to those in pieces assignments and provides the one memory writing instruction that such diagnostic passes can understand are an assignment over the entire tuple.
I included the full message for the main patch (#3) at the bottom of the PR. Below I included short high level abstracts of the patches:
[region-isolation] When assigning RValues into memory, use tuple_addr_constructor instead of doing it in pieces.
I also included changes to the rest of the SIL optimizer pipeline to ensure that
the part of the optimizer pipeline before we lower tuple_addr_constructor (which
is right after we run TransferNonSendable) work as before.
The reason why I am doing this is that this ensures that diagnostic passes can
tell the difference in between:
and
This is important for things like TransferNonSendable where assigning over the
entire tuple element is treated differently from if one were to initialize it in
pieces using projections.
rdar://117880194