@@ -336,10 +336,7 @@ static bool isStaticallyLookThroughInst(SILInstruction *inst) {
336336
337337 // If this cast introduces isolation due to conformances, we cannot look
338338 // through it to the source.
339- if (!SILIsolationInfo::getForCastConformances (
340- llvm::cast<UnconditionalCheckedCastInst>(inst),
341- cast.getSourceFormalType (), cast.getTargetFormalType ())
342- .isDisconnected ())
339+ if (SILIsolationInfo::getConformanceIsolation (inst))
343340 return false ;
344341
345342 if (cast.isRCIdentityPreserving ())
@@ -3166,7 +3163,8 @@ class PartitionOpTranslator {
31663163 case TranslationSemantics::Store:
31673164 return translateSILStore (
31683165 &inst->getAllOperands ()[CopyLikeInstruction::Dest],
3169- &inst->getAllOperands ()[CopyLikeInstruction::Src]);
3166+ &inst->getAllOperands ()[CopyLikeInstruction::Src],
3167+ SILIsolationInfo::getConformanceIsolation (inst));
31703168
31713169 case TranslationSemantics::Special:
31723170 return ;
@@ -3177,7 +3175,8 @@ class PartitionOpTranslator {
31773175 case TranslationSemantics::TerminatorPhi: {
31783176 TermArgSources sources;
31793177 sources.init (inst);
3180- return translateSILPhi (sources);
3178+ return translateSILPhi (
3179+ sources, SILIsolationInfo::getConformanceIsolation (inst));
31813180 }
31823181
31833182 case TranslationSemantics::Asserting:
@@ -3480,6 +3479,7 @@ CONSTANT_TRANSLATION(StoreInst, Store)
34803479CONSTANT_TRANSLATION(StoreWeakInst, Store)
34813480CONSTANT_TRANSLATION(MarkUnresolvedMoveAddrInst, Store)
34823481CONSTANT_TRANSLATION(UncheckedRefCastAddrInst, Store)
3482+ CONSTANT_TRANSLATION(UnconditionalCheckedCastAddrInst, Store)
34833483CONSTANT_TRANSLATION(StoreUnownedInst, Store)
34843484
34853485// ===---
@@ -3554,6 +3554,7 @@ CONSTANT_TRANSLATION(YieldInst, Require)
35543554// Terminators that act as phis.
35553555CONSTANT_TRANSLATION(BranchInst, TerminatorPhi)
35563556CONSTANT_TRANSLATION(CondBranchInst, TerminatorPhi)
3557+ CONSTANT_TRANSLATION(CheckedCastBranchInst, TerminatorPhi)
35573558CONSTANT_TRANSLATION(DynamicMethodBranchInst, TerminatorPhi)
35583559
35593560// Function exiting terminators.
@@ -3955,34 +3956,16 @@ PartitionOpTranslator::visitPointerToAddressInst(PointerToAddressInst *ptai) {
39553956
39563957TranslationSemantics PartitionOpTranslator::visitUnconditionalCheckedCastInst (
39573958 UnconditionalCheckedCastInst *ucci) {
3958- auto isolation = SILIsolationInfo::getForCastConformances (
3959- ucci, ucci->getSourceFormalType (), ucci->getTargetFormalType ());
3959+ auto isolation = SILIsolationInfo::getConformanceIsolation (ucci);
39603960
3961- if (isolation. isDisconnected () &&
3961+ if (! isolation &&
39623962 SILDynamicCastInst (ucci).isRCIdentityPreserving ()) {
39633963 assert (isStaticallyLookThroughInst (ucci) && " Out of sync" );
39643964 return TranslationSemantics::LookThrough;
39653965 }
39663966
39673967 assert (!isStaticallyLookThroughInst (ucci) && " Out of sync" );
3968- translateSILMultiAssign (
3969- ucci->getResults (), makeOperandRefRange (ucci->getAllOperands ()),
3970- isolation);
3971- return TranslationSemantics::Special;
3972- }
3973-
3974- TranslationSemantics PartitionOpTranslator::visitUnconditionalCheckedCastAddrInst (
3975- UnconditionalCheckedCastAddrInst *uccai) {
3976- auto isolation = SILIsolationInfo::getForCastConformances (
3977- uccai->getAllOperands ()[CopyLikeInstruction::Dest].get (),
3978- uccai->getSourceFormalType (), uccai->getTargetFormalType ());
3979-
3980- translateSILStore (
3981- &uccai->getAllOperands ()[CopyLikeInstruction::Dest],
3982- &uccai->getAllOperands ()[CopyLikeInstruction::Src],
3983- isolation);
3984-
3985- return TranslationSemantics::Special;
3968+ return TranslationSemantics::Assign;
39863969}
39873970
39883971// RefElementAddrInst is not considered to be a lookThrough since we want to
@@ -4079,32 +4062,10 @@ PartitionOpTranslator::visitInitExistentialValueInst(InitExistentialValueInst *i
40794062 return TranslationSemantics::Assign;
40804063}
40814064
4082- TranslationSemantics
4083- PartitionOpTranslator::visitCheckedCastBranchInst (CheckedCastBranchInst *ccbi) {
4084- // Consider whether the value produced by the cast might be task-isolated.
4085- auto resultValue = ccbi->getSuccessBB ()->getArgument (0 );
4086- auto conformanceIsolation = SILIsolationInfo::getForCastConformances (
4087- resultValue,
4088- ccbi->getSourceFormalType (),
4089- ccbi->getTargetFormalType ());
4090- TermArgSources sources;
4091- sources.init (static_cast <SILInstruction *>(ccbi));
4092- translateSILPhi (sources, conformanceIsolation);
4093-
4094- return TranslationSemantics::Special;
4095- }
4096-
40974065TranslationSemantics PartitionOpTranslator::visitCheckedCastAddrBranchInst (
40984066 CheckedCastAddrBranchInst *ccabi) {
40994067 assert (ccabi->getSuccessBB ()->getNumArguments () <= 1 );
41004068
4101- // Consider whether the value written into by the cast might be task-isolated.
4102- auto resultValue = ccabi->getAllOperands ().back ().get ();
4103- auto conformanceIsolation = SILIsolationInfo::getForCastConformances (
4104- resultValue,
4105- ccabi->getSourceFormalType (),
4106- ccabi->getTargetFormalType ());
4107-
41084069 // checked_cast_addr_br does not have any arguments in its resulting
41094070 // block. We should just use a multi-assign on its operands.
41104071 //
@@ -4114,7 +4075,7 @@ TranslationSemantics PartitionOpTranslator::visitCheckedCastAddrBranchInst(
41144075 // but still correct.
41154076 translateSILMultiAssign (ArrayRef<SILValue>(),
41164077 makeOperandRefRange (ccabi->getAllOperands ()),
4117- conformanceIsolation );
4078+ SILIsolationInfo::getConformanceIsolation (ccabi) );
41184079 return TranslationSemantics::Special;
41194080}
41204081
0 commit comments