Skip to content

Commit 501b21d

Browse files
committed
Sema: Micro-optimize adjustFunctionTypeForConcurrency()
1 parent e26034b commit 501b21d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7908,6 +7908,10 @@ AnyFunctionType *swift::adjustFunctionTypeForConcurrency(
79087908
(isa<AbstractFunctionDecl>(decl) &&
79097909
cast<AbstractFunctionDecl>(decl)->hasImplicitSelfDecl()));
79107910
if (!hasImplicitSelfDecl) {
7911+
// Fast path.
7912+
if (fnType->getExtInfo().getIsolation() == *funcIsolation)
7913+
return fnType;
7914+
79117915
return fnType->withExtInfo(
79127916
fnType->getExtInfo().withIsolation(*funcIsolation));
79137917
}
@@ -7917,6 +7921,10 @@ AnyFunctionType *swift::adjustFunctionTypeForConcurrency(
79177921
if (!innerFnType)
79187922
return fnType;
79197923

7924+
// Fast path.
7925+
if (innerFnType->getExtInfo().getIsolation() == *funcIsolation)
7926+
return fnType;
7927+
79207928
// Update the inner function type with the isolation.
79217929
innerFnType = innerFnType->withExtInfo(
79227930
innerFnType->getExtInfo().withIsolation(*funcIsolation));

0 commit comments

Comments
 (0)