[FFmpeg-devel] Disable inlining when using --disable-optimizations

Måns Rullgård mans
Thu Jul 30 23:04:31 CEST 2009

Jeff Downs <heydowns at borg.com> writes:

> When debugging issues and crashes in ffmpeg recently, I found it helpful 
> to have a way to disable inlining so you can get real stack frames for 
> each function. --disable-optimizations gets you most of the way there, but 
> functions marked av_always_inline will still get inlined.
> Turns out there is already a case for disabling av_always_inline 
> (--enable-small); I extended the conditions for that to include 
> disabled optimizations.

The blanket disabling of av_always_inline for --enable-small is
actually wrong.  Many of the functions marked with it are tiny,
smaller than the function call overhead, meaning they really should
always be inlined as doing so is both faster and smaller.

The problem is that av_always_inline is also used on a few fairly
large functions to ensure that gcc really does inline them, or
constant propagation will fail, and performance will suffer.

I'm undecided on how to best deal with these cases under CONFIG_SMALL.
Not inlining often does give slightly smaller code, at the expense of
lots of branches or similar.  It could be argued that when the user
asks for small, that's what he should get.  On the other hand,
inlining these functions (some of them, at least) makes the code
faster and only slightly larger.

Perhaps we need a three classes of inlining:

- the plain old inline
- forced inline, unless small
- forced inline, even when small

Thoughts appreciated.

M?ns Rullg?rd
mans at mansr.com

More information about the ffmpeg-devel mailing list