PerformanceInliner: add the @_semantics("optimize.sil.inline.aggressive") attribute to enable inlining into large functions.

This attribute overrides the limit of maximum number of basic blocks in the caller.
This commit is contained in:
Erik Eckstein
2025-02-13 07:40:24 +01:00
parent a022457257
commit 6af5876f72
3 changed files with 9 additions and 1 deletions

View File

@@ -412,6 +412,11 @@ optimize.sil.specialize.owned2guarantee.never
Disable function signature optimization which converts an "owned" to a
"guaranteed" function parameter.
optimize.sil.inline.aggressive
Inlines into this function more aggressively than it would be done without
this attribute.
Availability checks
~~~~~~~~~~~~~~~~~~~

View File

@@ -75,6 +75,8 @@ SEMANTICS_ATTR(OPTIMIZE_SIL_SPECIALIZE_GENERIC_SIZE_NEVER,
"optimize.sil.specialize.generic.size.never")
SEMANTICS_ATTR(OPTIMIZE_SIL_SPECIALIZE_OWNED2GUARANTEE_NEVER,
"optimize.sil.specialize.owned2guarantee.never")
SEMANTICS_ATTR(OPTIMIZE_SIL_INLINE_AGGRESSIVE,
"optimize.sil.inline.aggressive")
// To be used on a nominal type declaration.
// Assumes that a class (or class references inside a nominal type) are immortal.

View File

@@ -1153,7 +1153,8 @@ void SILPerformanceInliner::collectAppliesToInline(
// but we /do/ inline any inline_always functions remaining.
if (NumCallerBlocks > OverallCallerBlockLimit &&
// Still allow inlining of small functions.
!hasMaxNumberOfBasicBlocks(Callee, 8)) {
!hasMaxNumberOfBasicBlocks(Callee, 8) &&
!Caller->hasSemanticsAttr(semantics::OPTIMIZE_SIL_INLINE_AGGRESSIVE)) {
continue;
}