Skip to content

Fix PrunedLiveness.empty() to consider the users. #64051

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion include/swift/SIL/PrunedLiveness.h
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,9 @@ class PrunedLiveness {

bool empty() const {
assert(!liveBlocks.empty() || users.empty());
return liveBlocks.empty();
// There may be a liveBlock created by initializeDefBlock with no users. The
// true test of emptiness is whether there are any users.
return users.empty();
}

void clear() {
Expand Down
8 changes: 4 additions & 4 deletions lib/SIL/Utils/OSSALifetimeCompletion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
///
/// Interior liveness handles the following cases naturally:
///
/// When completing the lifetime if the initial value, %v1, transitively
/// include all dominated reborrows. %phi1 in this example:
/// When completing the lifetime of the initial value, %v1, transitively
/// include all uses of dominated reborrows as, such as %phi1 in this example:
///
/// %v1 = ...
/// cond_br bb1, bb2
Expand All @@ -31,8 +31,8 @@
/// end_borrow %phi1
/// %k1 = destroy_value %v1 // must be below end_borrow %phi1
///
/// When completing the lifetime for a (%phi2) transitively include all inner
/// adjacent reborrows (%phi1):
/// When completing the lifetime for a phi (%phi2) transitively include all
/// uses of inner adjacent reborrows, such as %phi1 in this example:
///
/// bb1:
/// %v1 = ...
Expand Down