4.4.2. When is it practical for the compiler to inline?
The compiler decides for itself when it is practical to inline a function or not, depending on a number of conditions, including:
the size of the function, and how many times it is called
the current optimization level
whether it is optimizing for speed (-Otime) or size (-Ospace)
whether the function has external or static linkage.
Ultimately, the compiler can decide not to inline a function, even if the function is qualified with __forceinline. As a general rule:
smaller functions stand a better chance of being inlined
compiling with -Otime increases the likelihood that a function is inlined
large functions are not normally inlined because this can adversely affect code density and performance.