Skip to content

Commit 6cd9376

Browse files
committed
Also check witness table devirtualization
1 parent 397a040 commit 6cd9376

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/SILOptimizer/Utils/Devirtualize.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,15 @@ static bool canDevirtualizeWitnessMethod(ApplySite AI) {
984984
return false;
985985
}
986986

987+
// devirtualizeWitnessMethod below does not support this case. It currently
988+
// assumes it can try_apply call the target.
989+
if (!F->getLoweredFunctionType()->hasErrorResult() &&
990+
isa<TryApplyInst>(AI.getInstruction())) {
991+
LLVM_DEBUG(llvm::dbgs() << " FAIL: Trying to devirtualize a "
992+
"try_apply but wtable entry has no error result.\n");
993+
return false;
994+
}
995+
987996
return true;
988997
}
989998

0 commit comments

Comments
 (0)