Skip to content

Commit b67c7c0

Browse files
committed
Update castValueToABICompatibleType for @guaranteed forwarding phi support
1 parent 5b6daed commit b67c7c0

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

lib/SILOptimizer/Utils/InstOptUtils.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -636,22 +636,6 @@ swift::castValueToABICompatibleType(SILBuilder *builder, SILLocation loc,
636636
auto *noneBB = builder->getFunction().createBasicBlockAfter(someBB);
637637

638638
auto *phi = contBB->createPhiArgument(destTy, value->getOwnershipKind());
639-
if (phi->getOwnershipKind() == OwnershipKind::Guaranteed) {
640-
auto createEndBorrow = [&](SILBasicBlock::iterator insertPt) {
641-
builder->setInsertionPoint(insertPt);
642-
builder->createEndBorrow(loc, phi);
643-
};
644-
for (SILInstruction *user : usePoints) {
645-
if (isa<TermInst>(user)) {
646-
assert(!isa<BranchInst>(user) && "no branch as guaranteed use point");
647-
for (auto *succBB : user->getParent()->getSuccessorBlocks()) {
648-
createEndBorrow(succBB->begin());
649-
}
650-
continue;
651-
}
652-
createEndBorrow(std::next(user->getIterator()));
653-
}
654-
}
655639

656640
SmallVector<std::pair<EnumElementDecl *, SILBasicBlock *>, 1> caseBBs;
657641
caseBBs.push_back(std::make_pair(someDecl, someBB));
@@ -677,17 +661,11 @@ swift::castValueToABICompatibleType(SILBuilder *builder, SILLocation loc,
677661
// rewrapped Optional.
678662
SILValue someValue =
679663
builder->createOptionalSome(loc, castedUnwrappedValue, destTy);
680-
if (phi->getOwnershipKind() == OwnershipKind::Guaranteed) {
681-
someValue = builder->createBeginBorrow(loc, someValue);
682-
}
683664
builder->createBranch(loc, contBB, {someValue});
684665

685666
// Handle the None case.
686667
builder->setInsertionPoint(noneBB);
687668
SILValue noneValue = builder->createOptionalNone(loc, destTy);
688-
if (phi->getOwnershipKind() == OwnershipKind::Guaranteed) {
689-
noneValue = builder->createBeginBorrow(loc, noneValue);
690-
}
691669
builder->createBranch(loc, contBB, {noneValue});
692670
builder->setInsertionPoint(contBB->begin());
693671

0 commit comments

Comments
 (0)