Skip to content

Commit 569b2aa

Browse files
committed
Update castValueToABICompatibleType for @guaranteed forwarding phi support
1 parent 5ede08c commit 569b2aa

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
@@ -640,22 +640,6 @@ swift::castValueToABICompatibleType(SILBuilder *builder, SILLocation loc,
640640
auto *noneBB = builder->getFunction().createBasicBlockAfter(someBB);
641641

642642
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-
}
659643

660644
SmallVector<std::pair<EnumElementDecl *, SILBasicBlock *>, 1> caseBBs;
661645
caseBBs.push_back(std::make_pair(someDecl, someBB));
@@ -681,17 +665,11 @@ swift::castValueToABICompatibleType(SILBuilder *builder, SILLocation loc,
681665
// rewrapped Optional.
682666
SILValue someValue =
683667
builder->createOptionalSome(loc, castedUnwrappedValue, destTy);
684-
if (phi->getOwnershipKind() == OwnershipKind::Guaranteed) {
685-
someValue = builder->createBeginBorrow(loc, someValue);
686-
}
687668
builder->createBranch(loc, contBB, {someValue});
688669

689670
// Handle the None case.
690671
builder->setInsertionPoint(noneBB);
691672
SILValue noneValue = builder->createOptionalNone(loc, destTy);
692-
if (phi->getOwnershipKind() == OwnershipKind::Guaranteed) {
693-
noneValue = builder->createBeginBorrow(loc, noneValue);
694-
}
695673
builder->createBranch(loc, contBB, {noneValue});
696674
builder->setInsertionPoint(contBB->begin());
697675

0 commit comments

Comments
 (0)