Skip to content

Commit 3f3ce70

Browse files
committed
NFC: Remove unused code + reorg
1 parent 0a6ac62 commit 3f3ce70

File tree

4 files changed

+6
-29
lines changed

4 files changed

+6
-29
lines changed

include/swift/SIL/OwnershipUtils.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -429,13 +429,7 @@ struct BorrowingOperand {
429429
/// set of its operands uses.
430430
///
431431
/// E.x.: end_apply uses.
432-
///
433-
/// \p errorFunction a callback that if non-null is passed an operand that
434-
/// triggers a mal-formed SIL error. This is just needed for the ownership
435-
/// verifier to emit good output.
436-
void getImplicitUses(
437-
SmallVectorImpl<Operand *> &foundUses,
438-
std::function<void(Operand *)> *errorFunction = nullptr) const;
432+
void getImplicitUses(SmallVectorImpl<Operand *> &foundUses) const;
439433

440434
void print(llvm::raw_ostream &os) const;
441435
SWIFT_DEBUG_DUMP { print(llvm::dbgs()); }

lib/SIL/IR/SILArgument.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,8 @@ bool SILPhiArgument::visitTransitiveIncomingPhiOperands(
240240
argument->getIncomingPhiOperands(operands);
241241

242242
for (auto *operand : operands) {
243-
SILPhiArgument *forwarded;
244-
if ((forwarded = dyn_cast<SILPhiArgument>(operand->get())) &&
245-
forwarded->isPhi()) {
243+
SILPhiArgument *forwarded = dyn_cast<SILPhiArgument>(operand->get());
244+
if (forwarded && forwarded->isPhi()) {
246245
worklist.insert(forwarded);
247246
}
248247
if (!visitor(argument, operand))

lib/SIL/Utils/OwnershipUtils.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,8 +667,7 @@ BorrowedValue BorrowingOperand::getBorrowIntroducingUserResult() {
667667
}
668668

669669
void BorrowingOperand::getImplicitUses(
670-
SmallVectorImpl<Operand *> &foundUses,
671-
std::function<void(Operand *)> *errorFunction) const {
670+
SmallVectorImpl<Operand *> &foundUses) const {
672671
// FIXME: this visitScopeEndingUses should never return false once dead
673672
// borrows are disallowed.
674673
if (!visitScopeEndingUses([&](Operand *endOp) {

lib/SIL/Verifier/SILOwnershipVerifier.cpp

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -254,14 +254,7 @@ bool SILValueOwnershipChecker::gatherNonGuaranteedUsers(
254254
// initial end scope instructions without any further work.
255255
//
256256
// Maybe: Is borrow scope non-local?
257-
std::function<void(Operand *)> error = [&](Operand *op) {
258-
errorBuilder.handleMalformedSIL([&] {
259-
llvm::errs() << "Implicit Regular User Guaranteed Phi Cycle!\n"
260-
<< "User: " << *op->getUser()
261-
<< "Initial: " << *initialScopedOperand << "\n";
262-
});
263-
};
264-
initialScopedOperand.getImplicitUses(nonLifetimeEndingUsers, &error);
257+
initialScopedOperand.getImplicitUses(nonLifetimeEndingUsers);
265258
if (initialScopedOperand.kind == BorrowingOperandKind::BeginBorrow) {
266259
guaranteedPhiVerifier.verifyReborrows(
267260
cast<BeginBorrowInst>(op->getUser()));
@@ -361,15 +354,7 @@ bool SILValueOwnershipChecker::gatherUsers(
361354
if (auto scopedOperand = BorrowingOperand(op)) {
362355
assert(!scopedOperand.isReborrow());
363356

364-
std::function<void(Operand *)> onError = [&](Operand *op) {
365-
errorBuilder.handleMalformedSIL([&] {
366-
llvm::errs() << "Implicit Regular User Guaranteed Phi Cycle!\n"
367-
<< "User: " << *op->getUser()
368-
<< "Initial: " << *scopedOperand << "\n";
369-
});
370-
};
371-
372-
scopedOperand.getImplicitUses(nonLifetimeEndingUsers, &onError);
357+
scopedOperand.getImplicitUses(nonLifetimeEndingUsers);
373358
if (scopedOperand.kind == BorrowingOperandKind::BeginBorrow) {
374359
guaranteedPhiVerifier.verifyReborrows(
375360
cast<BeginBorrowInst>(op->getUser()));

0 commit comments

Comments
 (0)