This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: LTO and the inlining of functions only called once.


> On Sat, Oct 10, 2009 at 12:55 PM, Toon Moene <toon@moene.org> wrote:
> > Gcc's man page says:
> >
> > ? ? ? -finline-functions-called-once
> > ? ? ? ? ? Consider all "static" functions called once for inlining into
> > ? ? ? ? ? their caller even if they are not marked "inline". ?If a call
> > ? ? ? ? ? to a given function is integrated, then the function is not
> > ? ? ? ? ? output as assembler code in its own right.
> >
> > ? ? ? ? ? Enabled at levels -O1, -O2, -O3 and -Os.
> >
> > Now, when using -flto -fwhole-program, *all* functions (that the user
> > provided) will be "static inline", no ? - so *all* functions only called
> > once in that program will be inlined ?
> 
> Well, I think that we should try to not do this across the whole program.
> Simply for the reason that a gigantic main function will hit several
> non-linear complexity algorithms in GCC.

We do inline functions called once until we hit large-function-growth
parameter.  The parameter is here to avoid hitting nonlinearity of
compiler and the fact that some passes simply give up on large
functions.
I did not experimented much with tunning these limits, it might be
interesting if they do make some difference in your testcase.
> 
> -Winline doesn't help here.  Scanning the assember output does (obviously!).

My solution would be probably to pass -fdump-ipa-inline parameter to lto
compilation and read the log.  It lists the inlining decisions and if
something is not inlined, you get dump of reason why.
The dump from lto compilation appears in /tmp for some reason.

Honza
> 
> Note that I wouldn't expect such aggressive inlining to have any positive
> performance impact - were it not for the fact that we still lack a properly
> operating IPA points-to analysis pass (yes, it's on my todo list - but
> not for 4.5).
> 
> Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]