Skip to content

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

Merged
merged 4 commits into from
Jun 22, 2023

Conversation

meg-gupta
Copy link
Contributor

No description provided.

@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta meg-gupta force-pushed the improvefindpointerescape branch from f3082db to 860aa58 Compare June 21, 2023 04:14
@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta meg-gupta force-pushed the improvefindpointerescape branch from 860aa58 to 6d3b4e0 Compare June 21, 2023 07:44
@meg-gupta
Copy link
Contributor Author

@swift-ci test

Copy link
Contributor

@nate-chandler nate-chandler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@meg-gupta
Copy link
Contributor Author

@swift-ci test macOS platform

@meg-gupta meg-gupta merged commit 28df449 into swiftlang:main Jun 22, 2023
nate-chandler added a commit to nate-chandler/swift that referenced this pull request Jul 6, 2023
The two implementations of findPointerEscape were merged back in
swiftlang#66723, so delete the declaration.
nate-chandler added a commit to nate-chandler/swift that referenced this pull request Jul 7, 2023
The two implementations of findPointerEscape were merged back in
swiftlang#66723, so delete the declaration.
Copy link
Contributor

@atrick atrick left a 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.
Copy link
Contributor

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()) {
Copy link
Contributor

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.

nate-chandler added a commit to nate-chandler/swift that referenced this pull request Jul 11, 2023
The two implementations of findPointerEscape were merged back in
swiftlang#66723, so delete the declaration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants