This is the mail archive of the gcc-patches@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: [PATCH] Make -Os inlining less magic


On 5/3/07, Jan Hubicka <jh@suse.cz> wrote:
> On Wed, 2 May 2007, Jan Hubicka wrote:
>
> > >
> > > This removes some magic constnats we use for inlining for -Os by just
> > > forcing the inliner to never grow what is inlined into.
> > >
> > > Bootstrapped and tested on x86_64-unknown-linux-gnu - I'm a bit nervous
> > > about the not-needed called once function change -- we cannot easily
> > > tell that apart from the regular case in cgraph_check_inline_limits().
> >
> > Actually I would say that cgraph_check_inline_limits should be follwed
> > here too - ie the only check in effect should be a check verifying that
> > caller body is not growing too much.  This is to prevent GCC from
> > exhibiting quadratic (or worse) behaviour that we don't want even on -Os
>
> Sure, but cgraph_check_inline_limits as patched will reject to inline
> functions called once that grow the caller body at all...
>
> Basically, in this case we want to ignore that we are optimizing for size.
> So there are two possibilities - copy what is needed from
> cgraph_check_inline_limits into the caller or unset optimize_size around
> the call.  (or add another param to cgraph_check_inline_limits)
>
> Thoughts?
Ah, I missed it while originally looking at the patch - you want to
modify cgraph_default_inline_p that is responsible to check that callee
is good enought rather than cgraph_check_inline_limits that is
responsible for checking the limits preventing GCC from exploding...
That way I think you need to modify just one place too ;)

How so? cgraph_default_inline_p only checks the callee, but for -Os we want the caller to not grow (or in case of inlining once called static functions grow over a certain limit). So, adjusting cgraph_check_inline_limits looks ok, just it doesn't seem (in its current form) applicable to the case of -Os and inlining static once called functions.

Richard.


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