Skip to content

Commit edb2dae

Browse files
committed
[region-isolation] Avoid using the function isolation when determining isolation of a sil_isolated parameter.
It is unnecessary and seems to be slightly out of sync sometimes around closures. (cherry picked from commit c1d0c8c)
1 parent cee9d0f commit edb2dae

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

lib/SIL/Verifier/SILVerifier.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6577,6 +6577,13 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
65776577
SILResultInfo::IsTransferring);
65786578
})),
65796579
"transferring result means all results are transferring");
6580+
6581+
// We should only ever have a single sil_isolated parameter.
6582+
require(1 >= std::count_if(FTy->getParameters().begin(), FTy->getParameters().end(),
6583+
[](const SILParameterInfo &parameterInfo) {
6584+
return parameterInfo.hasOption(SILParameterInfo::Isolated);
6585+
}),
6586+
"Should only ever be isolated to a single parameter");
65806587
}
65816588

65826589
struct VerifyFlowSensitiveRulesDetails {

lib/SILOptimizer/Utils/PartitionUtils.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -416,13 +416,10 @@ SILIsolationInfo SILIsolationInfo::get(SILArgument *arg) {
416416
// Before we do anything further, see if we have an isolated parameter. This
417417
// handles isolated self and specifically marked isolated.
418418
if (auto *isolatedArg = fArg->getFunction()->maybeGetIsolatedArgument()) {
419-
if (auto functionIsolation = fArg->getFunction()->getActorIsolation()) {
420-
assert(functionIsolation.isActorInstanceIsolated());
421-
if (auto *nomDecl =
422-
isolatedArg->getType().getNominalOrBoundGenericNominal()) {
423-
return SILIsolationInfo::getActorInstanceIsolated(fArg, isolatedArg,
424-
nomDecl);
425-
}
419+
if (auto *nomDecl =
420+
isolatedArg->getType().getNominalOrBoundGenericNominal()) {
421+
return SILIsolationInfo::getActorInstanceIsolated(fArg, isolatedArg,
422+
nomDecl);
426423
}
427424
}
428425

0 commit comments

Comments
 (0)