Skip to content

Commit e7d5b5e

Browse files
committed
[NFC] Inliner: throw blocks borrows end the same.
Previously, the SILInliner had a few lines of special-case code to handle adding end_borrow instructions to the throw block corresponding to a try_apply instruction. Because there's a mechanism for tracking all places where these end_borrows need to be inserted, just use that mechanism rather than having a special case for the throw block.
1 parent 94f4aca commit e7d5b5e

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

lib/SILOptimizer/Utils/SILInliner.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,6 @@ SILInlineCloner::cloneInline(ArrayRef<SILValue> AppliedArgs) {
443443
// Create the return block and set ReturnToBB for use in visitTerminator
444444
// callbacks.
445445
SILBasicBlock *callerBlock = Apply.getParent();
446-
SILBasicBlock *throwBlock = nullptr;
447446
SmallVector<SILInstruction *, 1> endBorrowInsertPts;
448447

449448
switch (Apply.getKind()) {
@@ -476,7 +475,7 @@ SILInlineCloner::cloneInline(ArrayRef<SILValue> AppliedArgs) {
476475
auto *tai = cast<TryApplyInst>(Apply);
477476
ReturnToBB = tai->getNormalBB();
478477
endBorrowInsertPts.push_back(&*ReturnToBB->begin());
479-
throwBlock = tai->getErrorBB();
478+
endBorrowInsertPts.push_back(&*tai->getErrorBB()->begin());
480479
break;
481480
}
482481
}
@@ -493,11 +492,6 @@ SILInlineCloner::cloneInline(ArrayRef<SILValue> AppliedArgs) {
493492
SILBuilderWithScope returnBuilder(insertPt, getBuilder());
494493
returnBuilder.createEndBorrow(Apply.getLoc(), entryArgs[i]);
495494
}
496-
497-
if (throwBlock) {
498-
SILBuilderWithScope throwBuilder(throwBlock->begin(), getBuilder());
499-
throwBuilder.createEndBorrow(Apply.getLoc(), entryArgs[i]);
500-
}
501495
}
502496
}
503497

0 commit comments

Comments
 (0)