-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[ownership] Add a higher level construct called BorrowScopeIntroducingOperand #27337
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
[ownership] Add a higher level construct called BorrowScopeIntroducingOperand #27337
Conversation
@swift-ci test |
@swift-ci test source compatibility |
I am testing source compatibility since I am expanding the ownership verification checks and want to make sure I am not breaking anything. |
include/swift/SIL/OwnershipUtils.h
Outdated
}; | ||
|
||
/// Operands that create a new borrow scope for an owned value passed as the | ||
/// operand's value. |
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 find this a little confusing. When an instruction produces a borrowed value, all of its uses are using the borrowed value. So how is an operand introducing the borrow?
Maybe this is just a BorrowedOperand?
So, the operand's operation introduces a borrow scope and the operand's value is borrowed for the duration of that operation's borrow scope. |
As is so often the case, long names are not helpful in communicating subtle information, where a short description works very well. |
Build failed |
os x failed in lldb |
@swift-ci test os x platform |
For those listening in, I did a bunch of testing here since I am expanding our verification here for end_apply. |
Build failed |
…d to work with implicit uses of owned parameters implied by their use by a borrow scope introducing value. For now this only is used for ensuring that an owned value that has a begin_borrow use, adds the end_borrows matched to the begin_borrow to the owned values implicit regular user list. I am going to use this same functionality to model the requirements around begin_apply and mark_dependence (when I add an end_mark_dependence instruction).
…ser list of owned parameters passed as guaranteed parameters to a begin_apply. This just follows automagically from the recent work that I did with introducing BorrowScopeIntroducingOperands. I confirmed locally that the negative tests do not fail as expected when visiting the destroys of the guaranteed parameters.
529fb13
to
f9f3f53
Compare
@swift-ci smoke test |
This will allow me to put easily in support for validating the implicit borrow scope creating in certain cases in ossa.
In this specific PR, I implement the construct and I add support for validating that owned parameters used by coroutines are not destroyed before the coroutine ends.