Skip to content

Commit e60d71a

Browse files
Merge pull request #11515 from aschwaighofer/osize_only_skip_inlining_for_methods
Osize: Only skip inlining for class methods
2 parents 2823e35 + 1b7a308 commit e60d71a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/SILOptimizer/Transforms/PerformanceInliner.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,13 @@ bool SILPerformanceInliner::isProfitableToInline(FullApplySite AI,
183183
if (AI.getFunction()->isThunk())
184184
return false;
185185

186-
// Don't inline methods.
187-
if (Callee->getRepresentation() == SILFunctionTypeRepresentation::Method)
188-
return false;
186+
// Don't inline class methods.
187+
if (Callee->hasSelfParam()) {
188+
auto SelfTy = Callee->getLoweredFunctionType()->getSelfInstanceType();
189+
if (SelfTy->mayHaveSuperclass() &&
190+
Callee->getRepresentation() == SILFunctionTypeRepresentation::Method)
191+
return false;
192+
}
189193

190194
BaseBenefit = BaseBenefit / 2;
191195
}

0 commit comments

Comments
 (0)