Skip to content

[ownership] Fix the linear lifetime checker to emit leak fixups for c… #22232

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

gottesmm
Copy link
Contributor

…ertain loops it didn't handle correctly before.

Specifically:

bb0:
br bb1

bb1:
cond_br ..., bb2, bb3

bb2:
br bb1

bb3:
return

What would happen in this case is that we wouldn't revisit bb1 after we found
the double consume to grab the leak (and would early exit as well). So we would
not insert a destroy for the out of loop value causing a leak from the
perspective of the ownership checker. This was due to us early exiting and also
due to us not revisiting bb1 after we went around the backedge from bb2 ->
bb1. Now what we do instead is if we catch a double consume in a block we have
already visited, we check if we haven't visited any of that block's
successors. If we haven't, we add that to the list of successors we need to
visit.

@gottesmm gottesmm requested a review from atrick January 29, 2019 23:31
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test and merge

@gottesmm
Copy link
Contributor Author

Jenkins error!

@gottesmm
Copy link
Contributor Author

@swift-ci smoke test OS X platform

@gottesmm
Copy link
Contributor Author

The failure is b/c we emit /all/ errors now instead of early exiting.

…ertain loops it didn't handle correctly before.

Specifically:

bb0:
  br bb1

bb1:
  cond_br ..., bb2, bb3

bb2:
  br bb1

bb3:
  return

What would happen in this case is that we wouldn't revisit bb1 after we found
the double consume to grab the leak (and would early exit as well). So we would
not insert a destroy for the out of loop value causing a leak from the
perspective of the ownership checker. This was due to us early exiting and also
due to us not revisiting bb1 after we went around the backedge from bb2 ->
bb1. Now what we do instead is if we catch a double consume in a block we have
already visited, we check if we haven't visited any of that block's
successors. If we haven't, we add that to the list of successors we need to
visit.
@gottesmm gottesmm force-pushed the pr-cdad162a7c2bbb546bb8ca3115b35fa2f0798ca9 branch from da18e64 to ac6f318 Compare January 30, 2019 00:40
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test and merge

2 similar comments
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test and merge

@gottesmm
Copy link
Contributor Author

@swift-ci smoke test and merge

@swift-ci swift-ci merged commit 99d8138 into swiftlang:master Jan 30, 2019
@gottesmm gottesmm deleted the pr-cdad162a7c2bbb546bb8ca3115b35fa2f0798ca9 branch January 30, 2019 01:17
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.

2 participants