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: Early inlining


> 
> On Jun 23, 2005, at 7:37 PM, Jan Hubicka wrote:
> 
> >Hi,
> >this patch adds early inlining.  As discussed earlier it helps
> >noticeably to cut down expenses of tree profiling on testcases with
> >extreme function call overhead (such as tramp3d).  It also save memory
> >on Gerald's testcase and makes GCC module compilation test apparently
> >tinny bit faster at -O3 (but close to noise).  In the future I would
> >like to have more optimizations in between the early inlining and real
> >inliing that will make this infrastructure bit more usefull, but at
> >the moment it seems to solve some side cases and have no measurable
> >overhead otherwise (even tought we rebuild cgraph edges after the  
> >early
> >passes) so I am enabling it by default now.
> ...
> 
> Jan -
> 
> After this patch, I see that static functions called once that are  
> inlined are no longer removed from the CFG during actual (not early)  
> inlining.  Assuming this is the intended behavior, there is a slight  
> issue that is raised in the function cgraph_decide_inlining().  This  
> can be seen by compiling the attached test.c with "-O3 -fdump-ipa- 
> all", producing a sefault.  The problem is that when inlining  
> functions called once (starting around ipa-inline.c:809), we call  
> cgraph_mark_inline() which creates a duplicate callee node, resetting  
> node->callers to NULL.  With dumps enabled, this causes a null- 
> pointer reference immediately after.  The attached patch addresses  
> the issue by holding on to the edge across the call to  
> cgraph_mark_inline.  I haven't run any regression tests on this yet,  
> but I wanted to be sure that the original behavior of no longer  
> removing CFG nodes was the intended behavior first.

Hi,
this should be fixed by the attached patch (I made the change while
inspecting the code for safety wrt removing the functions that may turn
out to be needed later, but this is too conservative).

2005-06-30  Jan Hubicka  <jh@suse.cz>
	* ipa-inline.c (cgraph_clone_inlined_nodes): Revert previous patch.
Index: ipa-inline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ipa-inline.c,v
retrieving revision 2.10
diff -c -3 -p -r2.10 ipa-inline.c
*** ipa-inline.c	28 Jun 2005 02:20:28 -0000	2.10
--- ipa-inline.c	30 Jun 2005 01:00:12 -0000
*************** cgraph_clone_inlined_nodes (struct cgrap
*** 121,127 ****
    if (!e->callee->callers->next_caller
        && (!e->callee->needed || DECL_EXTERNAL (e->callee->decl))
        && duplicate
!       && (flag_unit_at_a_time && cgraph_global_info_ready))
      {
        gcc_assert (!e->callee->global.inlined_to);
        if (!DECL_EXTERNAL (e->callee->decl))
--- 121,127 ----
    if (!e->callee->callers->next_caller
        && (!e->callee->needed || DECL_EXTERNAL (e->callee->decl))
        && duplicate
!       && flag_unit_at_a_time)
      {
        gcc_assert (!e->callee->global.inlined_to);
        if (!DECL_EXTERNAL (e->callee->decl))


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