Skip to content

[OSSA] Minor fixes to swift::findTransitiveUsesForAddress #62570

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 2 commits into from
Dec 15, 2022
Merged
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
17 changes: 8 additions & 9 deletions lib/SIL/Utils/OwnershipUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,8 @@ swift::findTransitiveUsesForAddress(SILValue projectedAddress,
isa<EndUnpairedAccessInst>(user) || isa<WitnessMethodInst>(user) ||
isa<SwitchEnumAddrInst>(user) || isa<CheckedCastAddrBranchInst>(user) ||
isa<SelectEnumAddrInst>(user) || isa<InjectEnumAddrInst>(user) ||
isa<IsUniqueInst>(user) || isa<ValueMetatypeInst>(user)) {
isa<IsUniqueInst>(user) || isa<ValueMetatypeInst>(user) ||
isa<DebugValueInst>(user) || isa<EndBorrowInst>(user)) {
leafUse(op);
continue;
}
Expand Down Expand Up @@ -1065,14 +1066,12 @@ swift::findTransitiveUsesForAddress(SILValue projectedAddress,

// If we have a load_borrow, add it's end scope to the liveness requirement.
if (auto *lbi = dyn_cast<LoadBorrowInst>(user)) {
if (foundUses) {
// FIXME: if we can assume complete lifetimes, then this should be
// as simple as:
// for (Operand *use : lbi->getUses()) {
// if (use->endsLocalBorrowScope()) {
if (!findInnerTransitiveGuaranteedUses(lbi, foundUses)) {
result = meet(result, AddressUseKind::PointerEscape);
}
// FIXME: if we can assume complete lifetimes, then this should be
// as simple as:
// for (Operand *use : lbi->getUses()) {
// if (use->endsLocalBorrowScope()) {
if (!findInnerTransitiveGuaranteedUses(lbi, foundUses)) {
result = meet(result, AddressUseKind::PointerEscape);
}
continue;
}
Expand Down