Skip to content

[OSSACompleteLifetime] Skip mark_dependence [unresolved]. #78466

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 1 commit 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
6 changes: 6 additions & 0 deletions lib/SIL/Utils/OSSALifetimeCompletion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,12 @@ bool OSSALifetimeCompletion::analyzeAndUpdateLifetime(
liveness.updateForUse(user, /*lifetimeEnding=*/true);
return true;
}
auto *mdi = dyn_cast<MarkDependenceInst>(user);
if (mdi && mdi->hasUnresolvedEscape()) {
// mark_dependence [unresolved] instructions can appear outside the
// lifetime of an access scope.
return true;
}
liveness.updateForUse(user, /*lifetimeEnding=*/false);
for (auto result : user->getResults()) {
auto shouldComplete =
Expand Down
11 changes: 11 additions & 0 deletions validation-test/SILOptimizer/rdar142424000.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// RUN: %target-swift-frontend -c %s

struct NC<Element>: ~Copyable {
var count: Int = 0
}
func playback_handler2() {
var iou_ptr: UnsafePointer<Bool>? = nil
var noncopyable = NC<Int>()
_ = noncopyable.count
_ = iou_ptr!.pointee
}