@@ -640,22 +640,6 @@ swift::castValueToABICompatibleType(SILBuilder *builder, SILLocation loc,
640
640
auto *noneBB = builder->getFunction ().createBasicBlockAfter (someBB);
641
641
642
642
auto *phi = contBB->createPhiArgument (destTy, value->getOwnershipKind ());
643
- if (phi->getOwnershipKind () == OwnershipKind::Guaranteed) {
644
- auto createEndBorrow = [&](SILBasicBlock::iterator insertPt) {
645
- builder->setInsertionPoint (insertPt);
646
- builder->createEndBorrow (loc, phi);
647
- };
648
- for (SILInstruction *user : usePoints) {
649
- if (isa<TermInst>(user)) {
650
- assert (!isa<BranchInst>(user) && " no branch as guaranteed use point" );
651
- for (auto *succBB : user->getParent ()->getSuccessorBlocks ()) {
652
- createEndBorrow (succBB->begin ());
653
- }
654
- continue ;
655
- }
656
- createEndBorrow (std::next (user->getIterator ()));
657
- }
658
- }
659
643
660
644
SmallVector<std::pair<EnumElementDecl *, SILBasicBlock *>, 1 > caseBBs;
661
645
caseBBs.push_back (std::make_pair (someDecl, someBB));
@@ -681,17 +665,11 @@ swift::castValueToABICompatibleType(SILBuilder *builder, SILLocation loc,
681
665
// rewrapped Optional.
682
666
SILValue someValue =
683
667
builder->createOptionalSome (loc, castedUnwrappedValue, destTy);
684
- if (phi->getOwnershipKind () == OwnershipKind::Guaranteed) {
685
- someValue = builder->createBeginBorrow (loc, someValue);
686
- }
687
668
builder->createBranch (loc, contBB, {someValue});
688
669
689
670
// Handle the None case.
690
671
builder->setInsertionPoint (noneBB);
691
672
SILValue noneValue = builder->createOptionalNone (loc, destTy);
692
- if (phi->getOwnershipKind () == OwnershipKind::Guaranteed) {
693
- noneValue = builder->createBeginBorrow (loc, noneValue);
694
- }
695
673
builder->createBranch (loc, contBB, {noneValue});
696
674
builder->setInsertionPoint (contBB->begin ());
697
675
0 commit comments