Skip to content

Commit 089df84

Browse files
authored
Merge pull request #67219 from nate-chandler/nfc/20230711/1/ownership-utils-cleanups
[OwnershipUtils] NFC: Two small cleanups.
2 parents 801629c + 0675454 commit 089df84

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed

include/swift/SIL/OwnershipUtils.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ inline bool isForwardingConsume(SILValue value) {
9090
// Ownership Def-Use Utilities
9191
//===----------------------------------------------------------------------===//
9292

93-
bool findPointerEscape(BorrowedValue value);
94-
9593
/// Whether the specified OSSA-lifetime introducer has a pointer escape.
9694
///
9795
/// precondition: \p value introduces an OSSA-lifetime, either a BorrowedValue

lib/SIL/Utils/OwnershipUtils.cpp

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -850,24 +850,10 @@ void BorrowedValue::print(llvm::raw_ostream &os) const {
850850

851851
void BorrowedValue::getLocalScopeEndingInstructions(
852852
SmallVectorImpl<SILInstruction *> &scopeEndingInsts) const {
853-
assert(isLocalScope() && "Should only call this given a local scope");
854-
855-
switch (kind) {
856-
case BorrowedValueKind::Invalid:
857-
llvm_unreachable("Using invalid case?!");
858-
case BorrowedValueKind::SILFunctionArgument:
859-
llvm_unreachable("Should only call this with a local scope");
860-
case BorrowedValueKind::BeginBorrow:
861-
case BorrowedValueKind::LoadBorrow:
862-
case BorrowedValueKind::Phi:
863-
for (auto *use : value->getUses()) {
864-
if (use->isLifetimeEnding()) {
865-
scopeEndingInsts.push_back(use->getUser());
866-
}
867-
}
868-
return;
869-
}
870-
llvm_unreachable("Covered switch isn't covered?!");
853+
visitLocalScopeEndingUses([&](auto *use) {
854+
scopeEndingInsts.push_back(use->getUser());
855+
return true;
856+
});
871857
}
872858

873859
// Note: BorrowedLifetimeExtender assumes no intermediate values between a

0 commit comments

Comments
 (0)