Add experimental feature @inline(always)

The intent for `@inline(always)` is to act as an optimization control.
The user can rely on inlining to happen or the compiler will emit an error
message.

Because function values can be dynamic (closures, protocol/class lookup)
this guarantee can only be upheld for direct function references.

In cases where the optimizer can resolve dynamic function values the
attribute shall be respected.

rdar://148608854
This commit is contained in:
Arnold Schwaighofer
2025-09-09 10:48:14 -07:00
parent c8f8736f6c
commit 25a071efc8
95 changed files with 1064 additions and 240 deletions

View File

@@ -357,7 +357,8 @@ static bool isOptimizableApplySite(ApplySite Apply) {
return false;
// Do not optimize always_inlinable functions.
if (callee->getInlineStrategy() == Inline_t::AlwaysInline)
if (callee->getInlineStrategy() == Inline_t::HeuristicAlwaysInline ||
callee->getInlineStrategy() == Inline_t::AlwaysInline)
return false;
if (callee->getLinkage() != SILLinkage::Private)