Skip to content

Commit a6c5e62

Browse files
committed
[embedded] Classify ApplyInst+friends as Existential or ExistentialClassBound based on the callee type
1 parent 6b9a305 commit a6c5e62

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/SIL/Utils/InstructionUtils.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -960,9 +960,16 @@ RuntimeEffect swift::getRuntimeEffect(SILInstruction *inst, SILType &impactType)
960960
case SILFunctionTypeRepresentation::Block:
961961
rt |= RuntimeEffect::ObjectiveC | RuntimeEffect::MetaData;
962962
break;
963-
case SILFunctionTypeRepresentation::WitnessMethod:
964-
rt |= RuntimeEffect::MetaData; // ???
963+
case SILFunctionTypeRepresentation::WitnessMethod: {
964+
auto conformance =
965+
as.getOrigCalleeType()->getWitnessMethodConformanceOrInvalid();
966+
if (conformance.getRequirement()->requiresClass()) {
967+
rt |= RuntimeEffect::MetaData | RuntimeEffect::ExistentialClassBound;
968+
} else {
969+
rt |= RuntimeEffect::MetaData | RuntimeEffect::Existential;
970+
}
965971
break;
972+
}
966973
case SILFunctionTypeRepresentation::CFunctionPointer:
967974
case SILFunctionTypeRepresentation::CXXMethod:
968975
case SILFunctionTypeRepresentation::Thin:

0 commit comments

Comments
 (0)