Skip to content

Commit 1b7a308

Browse files
committed
Osize: Only skip inlining for class methods
This addresses most of the regressions from the compat suite and some size saving gains.
1 parent 2823e35 commit 1b7a308

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)