-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Update canTriviallyDeleteOSSAEndScopeInst and a related assertion #72019
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
Conversation
aedb40b
to
a505c25
Compare
A destroy_value of Optional.none can be deleted. A move-only struct with deinit has a non trivial SILType but OwnershipKind::None, such values cannot be deleted.
a505c25
to
eb7772c
Compare
@swift-ci smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not opposed to this fix. I just want to make sure everyone understands that Ownership.none
can never apply to a struct-with-deinit. Ownership.none
literally means that the type is trivial on this path. Meaning we know there is no deinit on this path
@atrick You are right. My observation was from the earlier @_moveOnly type attribute which used Ownership::None even in the presence of deinit. |
But we can't assume Ownership::None implies anymore because a ~Copyable struct without deinit has OwnershipKind::None and non-trivial SILType ? |
I'm not really sure what assumptions are currently being made in move-only passes. I think In my mind, we would like The statement above
is consistent with that model of increasing information as the trivial representation is lowered. I just have no idea what is accomplished by making "~Copyable struct without deinit" nontrivial at the type level but trivial at the ownership level. |
That's a goal, yes. See rdar://123661042 . |
@atrick I created #72160 to show we can have Ownership.none for a non-copyable struct. |
A destroy_value of Optional.none can be deleted.
A move-only struct with deinit has a non trivial SILType but OwnershipKind::None, such values cannot be deleted.