mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[region-isolation] Move computation of SILIsolationInfo for a SILFunctionArgument onto SILIsolationInfo::get(...).
This commit is contained in:
@@ -3383,39 +3383,8 @@ TrackableValue RegionAnalysisValueMap::getTrackableValue(
|
||||
if (auto *fArg =
|
||||
dyn_cast<SILFunctionArgument>(iter.first->first.getValue())) {
|
||||
if (!isTransferrableFunctionArgument(fArg)) {
|
||||
auto *self =
|
||||
iter.first->first.getValue()->getFunction()->maybeGetSelfArgument();
|
||||
NominalTypeDecl *nomDecl = nullptr;
|
||||
if (self &&
|
||||
((nomDecl = self->getType().getNominalOrBoundGenericNominal()))) {
|
||||
iter.first->getSecond().mergeIsolationRegionInfo(
|
||||
SILIsolationInfo::getActorIsolated(nomDecl));
|
||||
return {iter.first->first, iter.first->second};
|
||||
}
|
||||
|
||||
// See if we can infer actor isolation from our fArg's value decl.
|
||||
//
|
||||
// This handles functions generated by SILGen with global actors, but
|
||||
// doesn't handle SIL written global actors since function arguments
|
||||
// parsed from SIL do not have associated var decls.
|
||||
if (auto *decl = fArg->getDecl()) {
|
||||
auto isolation =
|
||||
swift::getActorIsolation(const_cast<ValueDecl *>(decl));
|
||||
if (!bool(isolation)) {
|
||||
if (auto *dc = decl->getDeclContext()) {
|
||||
isolation = swift::getActorIsolationOfContext(dc);
|
||||
}
|
||||
}
|
||||
|
||||
if (isolation.isActorIsolated()) {
|
||||
iter.first->getSecond().mergeIsolationRegionInfo(
|
||||
SILIsolationInfo::getActorIsolated(isolation));
|
||||
return {iter.first->first, iter.first->second};
|
||||
}
|
||||
}
|
||||
|
||||
iter.first->getSecond().mergeIsolationRegionInfo(
|
||||
SILIsolationInfo::getTaskIsolated(fArg));
|
||||
SILIsolationInfo::get(fArg));
|
||||
return {iter.first->first, iter.first->second};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user