@@ -336,10 +336,7 @@ static bool isStaticallyLookThroughInst(SILInstruction *inst) {
336
336
337
337
// If this cast introduces isolation due to conformances, we cannot look
338
338
// 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))
343
340
return false ;
344
341
345
342
if (cast.isRCIdentityPreserving ())
@@ -3166,7 +3163,8 @@ class PartitionOpTranslator {
3166
3163
case TranslationSemantics::Store:
3167
3164
return translateSILStore (
3168
3165
&inst->getAllOperands ()[CopyLikeInstruction::Dest],
3169
- &inst->getAllOperands ()[CopyLikeInstruction::Src]);
3166
+ &inst->getAllOperands ()[CopyLikeInstruction::Src],
3167
+ SILIsolationInfo::getConformanceIsolation (inst));
3170
3168
3171
3169
case TranslationSemantics::Special:
3172
3170
return ;
@@ -3177,7 +3175,8 @@ class PartitionOpTranslator {
3177
3175
case TranslationSemantics::TerminatorPhi: {
3178
3176
TermArgSources sources;
3179
3177
sources.init (inst);
3180
- return translateSILPhi (sources);
3178
+ return translateSILPhi (
3179
+ sources, SILIsolationInfo::getConformanceIsolation (inst));
3181
3180
}
3182
3181
3183
3182
case TranslationSemantics::Asserting:
@@ -3480,6 +3479,7 @@ CONSTANT_TRANSLATION(StoreInst, Store)
3480
3479
CONSTANT_TRANSLATION(StoreWeakInst, Store)
3481
3480
CONSTANT_TRANSLATION(MarkUnresolvedMoveAddrInst, Store)
3482
3481
CONSTANT_TRANSLATION(UncheckedRefCastAddrInst, Store)
3482
+ CONSTANT_TRANSLATION(UnconditionalCheckedCastAddrInst, Store)
3483
3483
CONSTANT_TRANSLATION(StoreUnownedInst, Store)
3484
3484
3485
3485
// ===---
@@ -3554,6 +3554,7 @@ CONSTANT_TRANSLATION(YieldInst, Require)
3554
3554
// Terminators that act as phis.
3555
3555
CONSTANT_TRANSLATION(BranchInst, TerminatorPhi)
3556
3556
CONSTANT_TRANSLATION(CondBranchInst, TerminatorPhi)
3557
+ CONSTANT_TRANSLATION(CheckedCastBranchInst, TerminatorPhi)
3557
3558
CONSTANT_TRANSLATION(DynamicMethodBranchInst, TerminatorPhi)
3558
3559
3559
3560
// Function exiting terminators.
@@ -3955,34 +3956,16 @@ PartitionOpTranslator::visitPointerToAddressInst(PointerToAddressInst *ptai) {
3955
3956
3956
3957
TranslationSemantics PartitionOpTranslator::visitUnconditionalCheckedCastInst (
3957
3958
UnconditionalCheckedCastInst *ucci) {
3958
- auto isolation = SILIsolationInfo::getForCastConformances (
3959
- ucci, ucci->getSourceFormalType (), ucci->getTargetFormalType ());
3959
+ auto isolation = SILIsolationInfo::getConformanceIsolation (ucci);
3960
3960
3961
- if (isolation. isDisconnected () &&
3961
+ if (! isolation &&
3962
3962
SILDynamicCastInst (ucci).isRCIdentityPreserving ()) {
3963
3963
assert (isStaticallyLookThroughInst (ucci) && " Out of sync" );
3964
3964
return TranslationSemantics::LookThrough;
3965
3965
}
3966
3966
3967
3967
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;
3986
3969
}
3987
3970
3988
3971
// RefElementAddrInst is not considered to be a lookThrough since we want to
@@ -4079,32 +4062,10 @@ PartitionOpTranslator::visitInitExistentialValueInst(InitExistentialValueInst *i
4079
4062
return TranslationSemantics::Assign;
4080
4063
}
4081
4064
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
-
4097
4065
TranslationSemantics PartitionOpTranslator::visitCheckedCastAddrBranchInst (
4098
4066
CheckedCastAddrBranchInst *ccabi) {
4099
4067
assert (ccabi->getSuccessBB ()->getNumArguments () <= 1 );
4100
4068
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
-
4108
4069
// checked_cast_addr_br does not have any arguments in its resulting
4109
4070
// block. We should just use a multi-assign on its operands.
4110
4071
//
@@ -4114,7 +4075,7 @@ TranslationSemantics PartitionOpTranslator::visitCheckedCastAddrBranchInst(
4114
4075
// but still correct.
4115
4076
translateSILMultiAssign (ArrayRef<SILValue>(),
4116
4077
makeOperandRefRange (ccabi->getAllOperands ()),
4117
- conformanceIsolation );
4078
+ SILIsolationInfo::getConformanceIsolation (ccabi) );
4118
4079
return TranslationSemantics::Special;
4119
4080
}
4120
4081
0 commit comments