This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix cgraph_check_inline_limits
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Jan Hubicka <jh at suse dot cz>
- Date: Mon, 13 Mar 2006 13:31:47 +0100 (CET)
- Subject: Re: [PATCH] Fix cgraph_check_inline_limits
- References: <Pine.LNX.4.64.0603131304140.5416@t148.fhfr.qr>
On Mon, 13 Mar 2006, Richard Guenther wrote:
>
> This patch fixes two things in cgraph_check_inline_limits, for one,
> we were confused as to what callee list to walk (resulting in
> times == 0 always), second, we decided not to inline even if the
> inlining would result in the inlined-to-function size to shrink
> (if it is already > its limit due to always_inline functions).
>
> I'll bootstrap & regtest with a gcc_assert (times > 0) and put the
> patch on the internal various-c++ tests machine this night.
>
> Does this look reasonable?
In case anybody wonders about the following hunk
> Index: ipa-inline.c
> ===================================================================
> *** ipa-inline.c (revision 111993)
> --- ipa-inline.c (working copy)
> *************** cgraph_check_inline_limits (struct cgrap
> *** 251,263 ****
> int newsize;
> int limit;
>
> - if (to->global.inlined_to)
> - to = to->global.inlined_to;
> -
> for (e = to->callees; e; e = e->next_callee)
> if (e->callee == what)
> times++;
>
> /* When inlining large function body called once into small function,
> take the inlined function as base for limiting the growth. */
> if (to->local.self_insns > what->local.self_insns)
> --- 251,263 ----
> int newsize;
> int limit;
>
> for (e = to->callees; e; e = e->next_callee)
> if (e->callee == what)
> times++;
>
> + if (to->global.inlined_to)
> + to = to->global.inlined_to;
> +
> /* When inlining large function body called once into small function,
> take the inlined function as base for limiting the growth. */
> if (to->local.self_insns > what->local.self_insns)
this to->global.inlined_to stuff appeared with the big merge of
cgraph inlining (-r80333:80334). It looks like it _could_ be a merge
issue, but maybe it hints at a problem elsewhere. Basically we have
void __attribute__((always_inline)) foo(void) {}
static inline void bar(void) { foo(); }
void __attribute__((always_inline)) foobar(void) { bar(); }
void booh(void)
{
foobar();
foobar();
}
and at the point of inlining of small functions we try to inline
bar into booh, but with the above code get times == 0.
Richard.