-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Refactor swift::findPointerEscape and handle additional cases #66723
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
@swift-ci test |
Now that store_borrows are represented correctly, remove this hack.
…Escape(BorrowedValue)
f3082db
to
860aa58
Compare
@swift-ci test |
860aa58
to
6d3b4e0
Compare
@swift-ci 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.
lgtm!
@swift-ci test macOS platform |
The two implementations of findPointerEscape were merged back in swiftlang#66723, so delete the declaration.
The two implementations of findPointerEscape were merged back in swiftlang#66723, so delete the declaration.
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.
A couple of review comments. Otherwise very nice!
// | ||
// TODO: store_borrow is currently an InteriorPointer with no uses, so we end | ||
// up bailing. It should be in a dependence scope instead. It's not clear why | ||
// it produces an address at all. |
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.
We can remove the TODO comment now, but shouldn't we still report a dead projection as either a PointerEscape or Unknown? Otherwise, clients will need to separately look for and handle any possible dead projections. I don't think clients can currently handle that. Dead projections are unexpected but still legal SIL.
@@ -56,6 +56,13 @@ bool swift::findPointerEscape(SILValue original) { | |||
worklist.pushIfNotVisited(phi); | |||
break; | |||
} | |||
case OperandOwnership::Borrow: { | |||
auto borrowOp = BorrowingOperand(use); | |||
if (auto borrowValue = borrowOp.getBorrowIntroducingUserResult()) { |
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.
Can a yielded or captured value escape? I think we talked about this being illegal because it crosses a function boundary. But the implementation here doesn't explain why we're ignoring these cases. We should at least explain that it was intentional.
The two implementations of findPointerEscape were merged back in swiftlang#66723, so delete the declaration.
No description provided.