Re: Inlined functions



On Mon, 2005-10-31 at 22:11 -0500, Morten Welinder wrote:
> > All distros, save for say Gentoo, inline only functions explicitly asked
> > to be inlined.
> >
> > No additional compile-time inlining occurs.
> 
> Really?
>
> I want my foo back!

Weird.  From the man page:

        -O2 Optimize even more.  GCC performs nearly all supported
        optimizations that do not involve a space-speed tradeoff.  The
        compiler does not perform loop unrolling or function inlining
        when you specify -O2.  As compared to -O, this option increases
        both compilation time and the performance of the generated code.

-O3 is the option that says "okay, make space-time tradeoffs" and it
explicitly includes -finline-functions whilst -O2 does not.

Hrm.

Oh, I bet I know what happened.  The function is static.  And gcc
realizes it is const.  And static const functions are merged into the
caller if possible.  So the "42" was just pasted into the call site.  

	Robert Love





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]