@@ -326,10 +326,7 @@ static bool isStaticallyLookThroughInst(SILInstruction *inst) {
326
326
327
327
// If this cast introduces isolation due to conformances, we cannot look
328
328
// through it to the source.
329
- if (!SILIsolationInfo::getForCastConformances (
330
- llvm::cast<UnconditionalCheckedCastInst>(inst),
331
- cast.getSourceFormalType (), cast.getTargetFormalType ())
332
- .isDisconnected ())
329
+ if (SILIsolationInfo::getConformanceIsolation (inst))
333
330
return false ;
334
331
335
332
if (cast.isRCIdentityPreserving ())
@@ -3120,7 +3117,8 @@ class PartitionOpTranslator {
3120
3117
case TranslationSemantics::Store:
3121
3118
return translateSILStore (
3122
3119
&inst->getAllOperands ()[CopyLikeInstruction::Dest],
3123
- &inst->getAllOperands ()[CopyLikeInstruction::Src]);
3120
+ &inst->getAllOperands ()[CopyLikeInstruction::Src],
3121
+ SILIsolationInfo::getConformanceIsolation (inst));
3124
3122
3125
3123
case TranslationSemantics::Special:
3126
3124
return ;
@@ -3131,7 +3129,8 @@ class PartitionOpTranslator {
3131
3129
case TranslationSemantics::TerminatorPhi: {
3132
3130
TermArgSources sources;
3133
3131
sources.init (inst);
3134
- return translateSILPhi (sources);
3132
+ return translateSILPhi (
3133
+ sources, SILIsolationInfo::getConformanceIsolation (inst));
3135
3134
}
3136
3135
3137
3136
case TranslationSemantics::Asserting:
@@ -3436,6 +3435,7 @@ CONSTANT_TRANSLATION(StoreInst, Store)
3436
3435
CONSTANT_TRANSLATION(StoreWeakInst, Store)
3437
3436
CONSTANT_TRANSLATION(MarkUnresolvedMoveAddrInst, Store)
3438
3437
CONSTANT_TRANSLATION(UncheckedRefCastAddrInst, Store)
3438
+ CONSTANT_TRANSLATION(UnconditionalCheckedCastAddrInst, Store)
3439
3439
CONSTANT_TRANSLATION(StoreUnownedInst, Store)
3440
3440
3441
3441
// ===---
@@ -3510,6 +3510,7 @@ CONSTANT_TRANSLATION(YieldInst, Require)
3510
3510
// Terminators that act as phis.
3511
3511
CONSTANT_TRANSLATION(BranchInst, TerminatorPhi)
3512
3512
CONSTANT_TRANSLATION(CondBranchInst, TerminatorPhi)
3513
+ CONSTANT_TRANSLATION(CheckedCastBranchInst, TerminatorPhi)
3513
3514
CONSTANT_TRANSLATION(DynamicMethodBranchInst, TerminatorPhi)
3514
3515
3515
3516
// Function exiting terminators.
@@ -3911,34 +3912,16 @@ PartitionOpTranslator::visitPointerToAddressInst(PointerToAddressInst *ptai) {
3911
3912
3912
3913
TranslationSemantics PartitionOpTranslator::visitUnconditionalCheckedCastInst (
3913
3914
UnconditionalCheckedCastInst *ucci) {
3914
- auto isolation = SILIsolationInfo::getForCastConformances (
3915
- ucci, ucci->getSourceFormalType (), ucci->getTargetFormalType ());
3915
+ auto isolation = SILIsolationInfo::getConformanceIsolation (ucci);
3916
3916
3917
- if (isolation. isDisconnected () &&
3917
+ if (! isolation &&
3918
3918
SILDynamicCastInst (ucci).isRCIdentityPreserving ()) {
3919
3919
assert (isStaticallyLookThroughInst (ucci) && " Out of sync" );
3920
3920
return TranslationSemantics::LookThrough;
3921
3921
}
3922
3922
3923
3923
assert (!isStaticallyLookThroughInst (ucci) && " Out of sync" );
3924
- translateSILMultiAssign (
3925
- ucci->getResults (), makeOperandRefRange (ucci->getAllOperands ()),
3926
- isolation);
3927
- return TranslationSemantics::Special;
3928
- }
3929
-
3930
- TranslationSemantics PartitionOpTranslator::visitUnconditionalCheckedCastAddrInst (
3931
- UnconditionalCheckedCastAddrInst *uccai) {
3932
- auto isolation = SILIsolationInfo::getForCastConformances (
3933
- uccai->getAllOperands ()[CopyLikeInstruction::Dest].get (),
3934
- uccai->getSourceFormalType (), uccai->getTargetFormalType ());
3935
-
3936
- translateSILStore (
3937
- &uccai->getAllOperands ()[CopyLikeInstruction::Dest],
3938
- &uccai->getAllOperands ()[CopyLikeInstruction::Src],
3939
- isolation);
3940
-
3941
- return TranslationSemantics::Special;
3924
+ return TranslationSemantics::Assign;
3942
3925
}
3943
3926
3944
3927
// RefElementAddrInst is not considered to be a lookThrough since we want to
@@ -4035,32 +4018,10 @@ PartitionOpTranslator::visitInitExistentialValueInst(InitExistentialValueInst *i
4035
4018
return TranslationSemantics::Assign;
4036
4019
}
4037
4020
4038
- TranslationSemantics
4039
- PartitionOpTranslator::visitCheckedCastBranchInst (CheckedCastBranchInst *ccbi) {
4040
- // Consider whether the value produced by the cast might be task-isolated.
4041
- auto resultValue = ccbi->getSuccessBB ()->getArgument (0 );
4042
- auto conformanceIsolation = SILIsolationInfo::getForCastConformances (
4043
- resultValue,
4044
- ccbi->getSourceFormalType (),
4045
- ccbi->getTargetFormalType ());
4046
- TermArgSources sources;
4047
- sources.init (static_cast <SILInstruction *>(ccbi));
4048
- translateSILPhi (sources, conformanceIsolation);
4049
-
4050
- return TranslationSemantics::Special;
4051
- }
4052
-
4053
4021
TranslationSemantics PartitionOpTranslator::visitCheckedCastAddrBranchInst (
4054
4022
CheckedCastAddrBranchInst *ccabi) {
4055
4023
assert (ccabi->getSuccessBB ()->getNumArguments () <= 1 );
4056
4024
4057
- // Consider whether the value written into by the cast might be task-isolated.
4058
- auto resultValue = ccabi->getAllOperands ().back ().get ();
4059
- auto conformanceIsolation = SILIsolationInfo::getForCastConformances (
4060
- resultValue,
4061
- ccabi->getSourceFormalType (),
4062
- ccabi->getTargetFormalType ());
4063
-
4064
4025
// checked_cast_addr_br does not have any arguments in its resulting
4065
4026
// block. We should just use a multi-assign on its operands.
4066
4027
//
@@ -4070,7 +4031,7 @@ TranslationSemantics PartitionOpTranslator::visitCheckedCastAddrBranchInst(
4070
4031
// but still correct.
4071
4032
translateSILMultiAssign (ArrayRef<SILValue>(),
4072
4033
makeOperandRefRange (ccabi->getAllOperands ()),
4073
- conformanceIsolation );
4034
+ SILIsolationInfo::getConformanceIsolation (ccabi) );
4074
4035
return TranslationSemantics::Special;
4075
4036
}
4076
4037
0 commit comments