Skip to content

Commit 253cd4b

Browse files
committed
[AddressLowering] NFC: Removed loop of length 1.
1 parent 530af74 commit 253cd4b

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

lib/SILOptimizer/Mandatory/AddressLowering.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3442,17 +3442,18 @@ emitEndBorrowsAtEnclosingGuaranteedBoundary(SILValue lifetimeToEnd,
34423442
introducers.push_back(introducer);
34433443
return true;
34443444
});
3445+
/// Since aggregating instructions (struct, tuple, enum) change
3446+
/// representation, there can only be a single introducer.
34453447
assert(introducers.size() == 1);
3446-
for (auto introducer : introducers) {
3447-
assert(introducer->getType().isAddressOnly(*pass.function));
3448-
auto borrow = BorrowedValue(introducer);
3449-
borrow.visitLocalScopeEndingUses([&](Operand *use) {
3450-
assert(!PhiOperand(use));
3451-
pass.getBuilder(use->getUser()->getIterator())
3452-
.createEndBorrow(pass.genLoc(), lifetimeToEnd);
3453-
return true;
3454-
});
3455-
}
3448+
auto introducer = introducers[0];
3449+
assert(introducer->getType().isAddressOnly(*pass.function));
3450+
auto borrow = BorrowedValue(introducer);
3451+
borrow.visitLocalScopeEndingUses([&](Operand *use) {
3452+
assert(!PhiOperand(use));
3453+
pass.getBuilder(use->getUser()->getIterator())
3454+
.createEndBorrow(pass.genLoc(), lifetimeToEnd);
3455+
return true;
3456+
});
34563457
}
34573458

34583459
// Extract from an opaque struct or tuple.

0 commit comments

Comments
 (0)