-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[move-only] A few small changes in preparation for a larger patch #63755
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
gottesmm
merged 11 commits into
swiftlang:main
from
gottesmm:pr-dac78af5673ab6d4a9bebea882b8440c37c9457c
Feb 19, 2023
Merged
[move-only] A few small changes in preparation for a larger patch #63755
gottesmm
merged 11 commits into
swiftlang:main
from
gottesmm:pr-dac78af5673ab6d4a9bebea882b8440c37c9457c
Feb 19, 2023
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@swift-ci smoke test |
… copy and asks to file a bug.
…VarCarryingInst and VarDeclCarryingInst.
I am using this query a lot in SILGen when adding support for escaping captures. Makes sense to chop it off into a nice little helper on SILType.
…a SILBoxType from the SILType field for you.
Just treating it the same as copy_addr as expected.
This works by emitting an object level copy_addr if an address type is loadable (that is using load [take] + store [init] instead of copy_addr).
…sform. Specifically, our operand /could/ be a SILArgument. In that case, oldInst in all of these cases will be a nullptr. So make sure to only delete them if we actually found a defining instruction.
…ship specifier. Otherwise, we cannot parse our own compiler output around guaranteed boxes. I discovered this when writing tests for the next commit. rdar://105635396
…pe, move mark_must_check onto alloc_stack and always ensure that we use consumable_to_assign. What this patch is does is add an extra phase after alloc_box runs where we look at uses of the alloc_stack and if we see any mark_must_check of any kind, we delete them and rewrite a single mark_must_check [consumable_and_assignable] on the alloc_stack and make all uses of the alloc_stack go through the mark_must_check. This has two effects: 1. In a subsequent PR when I add noncopyable semantics for escaping closures, this will cause allocbox to stack to convert such boxes from having escaping semantics to having non-escaping semantics. Escaping semantics means that we always reproject out from the box and use mark_must_check [assignable_but_not_consumable] (since we can't consume from the box, but can assign to it). In contrast, non-escaping semantics means that the box becomes an alloc_stack and we use the traditional var checker semantics. NOTE: We can do this for lets represented as addresses and vars since the typechecker will validate that the let is never actually written to even if at the SIL level we would allow that. 2. In cases where we are implementing simple mark_must_check [consumable_and_assignable] on one of the project_box and capture the box, we used to have a problem where the direct box uses would be on the alloc_stack and not go through the mark_must_check. Now, all uses after allocbox_to_stack occur go through the mark_must_check. This is why I was able to remove instances of the "compiler does not understand this pattern" errors... since the compiler with this change can now understand them.
430c7ab
to
969d776
Compare
Put some more small changes in here cutting off from a larger change. |
@swift-ci smoke test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 a few small helper PRs and also enables by default a diagnostic error that is emitted if the checkers missed a copy. The diagnostic asks the user to file a bug. This is better than crashing the compiler.