Handle flattening in early inliner

Jan Hubicka hubicka@ucw.cz
Sun Apr 18 18:02:00 GMT 2010


> On Sun, Apr 18, 2010 at 1:44 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
> > Hi,
> > this patch makes early inliner to handle flattening (that is flatten as much as
> > it can leaving rest of work for late inliner).  This helps to get more realistic
> > profiles on flattended nodes and also more effective profiling and profile feedback.
> >
> > Bootstrapped/regtested x86_64-linux, comitted.
> >
> >        * ipa-inline.c (cgraph_early_inlining): Handle flattening too.
> > Index: ipa-inline.c
> > ===================================================================
> > --- ipa-inline.c        (revision 158462)
> > +++ ipa-inline.c        (working copy)
> > @@ -1667,6 +1667,17 @@ cgraph_early_inlining (void)
> >     }
> >   else
> >     {
> > +      if (lookup_attribute ("flatten",
> > +                           DECL_ATTRIBUTES (node->decl)) != NULL)
> > +       {
> > +         if (dump_file)
> > +           fprintf (dump_file,
> > +                    "Flattening %s\n", cgraph_node_name (node));
> > +         cgraph_flatten (node);
> > +         timevar_push (TV_INTEGRATION);
> > +         todo |= optimize_inline_calls (current_function_decl);
> > +         timevar_pop (TV_INTEGRATION);
> > +       }
> 
> you should be able to skip the following code for non-flatten
> functions.  Thus place it in else { .. }.

The following code handle inlining of indirect calls via iteration, so I
decided to keep it so "flatten" decorated functions won't end up with less
inlining than non-flatten decorated ones (i.e. I am trying those attributes to
monotonously increase amount of inlining in general as that is what they are
supposed to do).  But it is not big deal.

Honza
> 
> Richard.
> 
> >       /* We iterate incremental inlining to get trivial cases of indirect
> >         inlining.  */
> >       while (iterations < PARAM_VALUE (PARAM_EARLY_INLINER_MAX_ITERATIONS)
> >



More information about the Gcc-patches mailing list