Skip to content

Commit c1d0c8c

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.
1 parent 5e6b247 commit c1d0c8c

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
@@ -6578,6 +6578,13 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
65786578
SILResultInfo::IsTransferring);
65796579
})),
65806580
"transferring result means all results are transferring");
6581+
6582+
// We should only ever have a single sil_isolated parameter.
6583+
require(1 >= std::count_if(FTy->getParameters().begin(), FTy->getParameters().end(),
6584+
[](const SILParameterInfo &parameterInfo) {
6585+
return parameterInfo.hasOption(SILParameterInfo::Isolated);
6586+
}),
6587+
"Should only ever be isolated to a single parameter");
65816588
}
65826589

65836590
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)