@@ -518,10 +518,6 @@ RuntimeEffect swift::getRuntimeEffect(SILInstruction *inst, SILType &impactType)
518
518
case SILInstructionKind::UncheckedTakeEnumDataAddrInst:
519
519
case SILInstructionKind::SelectEnumInst:
520
520
case SILInstructionKind::SelectEnumAddrInst:
521
- case SILInstructionKind::OpenExistentialMetatypeInst:
522
- case SILInstructionKind::OpenExistentialBoxInst:
523
- case SILInstructionKind::OpenExistentialValueInst:
524
- case SILInstructionKind::OpenExistentialBoxValueInst:
525
521
case SILInstructionKind::ProjectBlockStorageInst:
526
522
case SILInstructionKind::UnreachableInst:
527
523
case SILInstructionKind::ReturnInst:
@@ -569,6 +565,12 @@ RuntimeEffect swift::getRuntimeEffect(SILInstruction *inst, SILType &impactType)
569
565
case SILInstructionKind::PackLengthInst:
570
566
case SILInstructionKind::DebugStepInst:
571
567
return RuntimeEffect::NoEffect;
568
+
569
+ case SILInstructionKind::OpenExistentialMetatypeInst:
570
+ case SILInstructionKind::OpenExistentialBoxInst:
571
+ case SILInstructionKind::OpenExistentialValueInst:
572
+ case SILInstructionKind::OpenExistentialBoxValueInst:
573
+ return RuntimeEffect::Existential;
572
574
573
575
case SILInstructionKind::DebugValueInst:
574
576
// Ignore runtime calls of debug_value
@@ -636,10 +638,12 @@ RuntimeEffect swift::getRuntimeEffect(SILInstruction *inst, SILType &impactType)
636
638
case SILInstructionKind::InitExistentialValueInst:
637
639
impactType = inst->getOperand (0 )->getType ();
638
640
return RuntimeEffect::Allocating | RuntimeEffect::Releasing |
639
- RuntimeEffect::MetaData;
641
+ RuntimeEffect::MetaData | RuntimeEffect::Existential ;
640
642
641
643
case SILInstructionKind::InitExistentialRefInst:
642
644
case SILInstructionKind::InitExistentialMetatypeInst:
645
+ impactType = inst->getOperand (0 )->getType ();
646
+ return RuntimeEffect::MetaData | RuntimeEffect::Existential;
643
647
case SILInstructionKind::ObjCToThickMetatypeInst:
644
648
impactType = inst->getOperand (0 )->getType ();
645
649
return RuntimeEffect::MetaData;
@@ -655,18 +659,18 @@ RuntimeEffect swift::getRuntimeEffect(SILInstruction *inst, SILType &impactType)
655
659
case SILInstructionKind::OpenExistentialAddrInst:
656
660
if (cast<OpenExistentialAddrInst>(inst)->getAccessKind () ==
657
661
OpenedExistentialAccess::Mutable)
658
- return RuntimeEffect::Allocating;
659
- return RuntimeEffect::NoEffect ;
662
+ return RuntimeEffect::Allocating | RuntimeEffect::Existential ;
663
+ return RuntimeEffect::Existential ;
660
664
661
665
case SILInstructionKind::OpenExistentialRefInst: {
662
666
SILType opType = cast<OpenExistentialRefInst>(inst)->getOperand ()->getType ();
663
667
impactType = opType;
664
668
if (opType.getASTType ()->isObjCExistentialType ()) {
665
- return RuntimeEffect::MetaData;
669
+ return RuntimeEffect::MetaData | RuntimeEffect::Existential ;
666
670
}
667
- return RuntimeEffect::MetaData;
668
- // TODO: should be NoEffect
669
- // return RuntimeEffect::NoEffect ;
671
+ return RuntimeEffect::MetaData | RuntimeEffect::Existential ;
672
+ // TODO: should be Existential
673
+ // return RuntimeEffect::Existential ;
670
674
}
671
675
672
676
case SILInstructionKind::UnconditionalCheckedCastInst:
@@ -712,8 +716,11 @@ RuntimeEffect swift::getRuntimeEffect(SILInstruction *inst, SILType &impactType)
712
716
}
713
717
return RuntimeEffect::Allocating;
714
718
}
715
- case SILInstructionKind::AllocBoxInst:
716
719
case SILInstructionKind::AllocExistentialBoxInst:
720
+ impactType = cast<SingleValueInstruction>(inst)->getType ();
721
+ return RuntimeEffect::Allocating | RuntimeEffect::MetaData |
722
+ RuntimeEffect::Releasing | RuntimeEffect::Existential;
723
+ case SILInstructionKind::AllocBoxInst:
717
724
case SILInstructionKind::AllocRefInst:
718
725
case SILInstructionKind::AllocRefDynamicInst:
719
726
impactType = cast<SingleValueInstruction>(inst)->getType ();
@@ -890,7 +897,7 @@ RuntimeEffect swift::getRuntimeEffect(SILInstruction *inst, SILType &impactType)
890
897
rt |= RuntimeEffect::ObjectiveC | RuntimeEffect::MetaData;
891
898
break ;
892
899
case SILFunctionTypeRepresentation::WitnessMethod:
893
- rt |= RuntimeEffect::MetaData;
900
+ rt |= RuntimeEffect::MetaData | RuntimeEffect::Existential ;
894
901
break ;
895
902
case SILFunctionTypeRepresentation::CFunctionPointer:
896
903
case SILFunctionTypeRepresentation::CXXMethod:
0 commit comments