IT lexicon › Programming › Partial inlining

Partial inlining

Programming På svenska → Updated: 2026-11-05

Pasting only the cheap, common part of a function into its caller and leaving the rest behind as an ordinary call.

Plenty of functions open with a quick check — is the pointer null, is the value already cached, is the buffer empty — followed by a long slow path that rarely runs. The whole function is too big to inline, but in most calls only the opening matters. So the compiler splits it: the fast path is inlined, and the rest is outlined into a separate function that's called only when the check falls through.

GCC has done this in its ipa-split pass since version 4.6 in 2011, and LLVM has a pass of its own. The effect is the same as a programmer hand-writing a small inline function whose if calls a noinline helper — a pattern all over the Linux kernel and countless standard libraries. It works best with profile data, since then it knows which path really is the common one.

← Back to the lexicon