@@ -3298,64 +3298,17 @@ TrackableValue RegionAnalysisValueMap::getTrackableValue(
3298
3298
}
3299
3299
}
3300
3300
3301
- if (auto *defInst = value.getDefiningInstruction ()) {
3302
- // Treat function ref as either actor isolated or sendable.
3303
- if (auto *fri = dyn_cast<FunctionRefInst>(defInst)) {
3304
- auto isolation = fri->getReferencedFunction ()->getActorIsolation ();
3305
- if (isolation.isActorIsolated ()) {
3306
- iter.first ->getSecond ().mergeIsolationRegionInfo (
3307
- SILIsolationInfo::getActorIsolated (value, isolation));
3308
- return {iter.first ->first , iter.first ->second };
3309
- }
3310
-
3311
- // Otherwise, lets look at the AST and see if our function ref is from an
3312
- // autoclosure.
3313
- if (auto *autoclosure = fri->getLoc ().getAsASTNode <AutoClosureExpr>()) {
3314
- if (auto *funcType = autoclosure->getType ()->getAs <AnyFunctionType>()) {
3315
- if (funcType->hasGlobalActor ()) {
3316
- if (funcType->hasGlobalActor ()) {
3317
- iter.first ->getSecond ().mergeIsolationRegionInfo (
3318
- SILIsolationInfo::getActorIsolated (
3319
- fri, ActorIsolation::forGlobalActor (
3320
- funcType->getGlobalActor ())));
3321
- return {iter.first ->first , iter.first ->second };
3322
- }
3323
- }
3324
-
3325
- if (auto *resultFType =
3326
- funcType->getResult ()->getAs <AnyFunctionType>()) {
3327
- if (resultFType->hasGlobalActor ()) {
3328
- iter.first ->getSecond ().mergeIsolationRegionInfo (
3329
- SILIsolationInfo::getActorIsolated (
3330
- fri, ActorIsolation::forGlobalActor (
3331
- resultFType->getGlobalActor ())));
3332
- return {iter.first ->first , iter.first ->second };
3333
- }
3334
- }
3335
- }
3336
- }
3337
-
3338
- iter.first ->getSecond ().addFlag (TrackableValueFlag::isSendable);
3301
+ // Treat function ref and class method as either actor isolated or
3302
+ // sendable. Formally they are non-Sendable, so we do the check before we
3303
+ // check the oracle.
3304
+ if (isa<FunctionRefInst, ClassMethodInst>(value)) {
3305
+ if (auto isolation = SILIsolationInfo::get (value)) {
3306
+ iter.first ->getSecond ().mergeIsolationRegionInfo (isolation);
3339
3307
return {iter.first ->first , iter.first ->second };
3340
3308
}
3341
3309
3342
- if (auto *cmi = dyn_cast<ClassMethodInst>(defInst)) {
3343
- if (auto *declRefExpr = cmi->getLoc ().getAsASTNode <DeclRefExpr>()) {
3344
- // See if we are actor isolated. If so, treat this as non-Sendable so we
3345
- // propagate actor isolation.
3346
- if (auto isolation = getActorIsolation (declRefExpr->getDecl ())) {
3347
- if (isolation.isActorIsolated ()) {
3348
- iter.first ->getSecond ().mergeIsolationRegionInfo (
3349
- SILIsolationInfo::getActorIsolated (cmi->getOperand (),
3350
- isolation));
3351
- return {iter.first ->first , iter.first ->second };
3352
- }
3353
- }
3354
- }
3355
-
3356
- iter.first ->getSecond ().addFlag (TrackableValueFlag::isSendable);
3357
- return {iter.first ->first , iter.first ->second };
3358
- }
3310
+ iter.first ->getSecond ().addFlag (TrackableValueFlag::isSendable);
3311
+ return {iter.first ->first , iter.first ->second };
3359
3312
}
3360
3313
3361
3314
// Otherwise refer to the oracle. If we have a Sendable value, just return.
0 commit comments