This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[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:08:59 +0100 (CET)
- Subject: [PATCH] Fix cgraph_check_inline_limits
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?
Thanks,
Richard.
2006-03-13 Richard Guenther <rguenther@suse.de>
* ipa-inline.c (cgraph_check_inline_limits): Walk the correct
node for the callees. Always allow inlining if it will shrink
the function size.
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)
*************** cgraph_check_inline_limits (struct cgrap
*** 267,274 ****
limit += limit * PARAM_VALUE (PARAM_LARGE_FUNCTION_GROWTH) / 100;
newsize = cgraph_estimate_size_after_inlining (times, to, what);
! if (newsize > PARAM_VALUE (PARAM_LARGE_FUNCTION_INSNS)
&& newsize > limit)
{
if (reason)
--- 267,277 ----
limit += limit * PARAM_VALUE (PARAM_LARGE_FUNCTION_GROWTH) / 100;
+ /* Check the size after inlining against the function limits. But allow
+ the function to shrink if it went over the limits by forced inlining. */
newsize = cgraph_estimate_size_after_inlining (times, to, what);
! if (newsize >= to->global.insns
! && newsize > PARAM_VALUE (PARAM_LARGE_FUNCTION_INSNS)
&& newsize > limit)
{
if (reason)