public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Handle flattening in early inliner
@ 2010-04-17 23:49 Jan Hubicka
  2010-04-18 17:34 ` Richard Guenther
  2010-07-16 15:32 ` H.J. Lu
  0 siblings, 2 replies; 5+ messages in thread
From: Jan Hubicka @ 2010-04-17 23:49 UTC (permalink / raw)
  To: gcc-patches

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);
+	}
       /* We iterate incremental inlining to get trivial cases of indirect
 	 inlining.  */
       while (iterations < PARAM_VALUE (PARAM_EARLY_INLINER_MAX_ITERATIONS)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Handle flattening in early inliner
  2010-04-17 23:49 Handle flattening in early inliner Jan Hubicka
@ 2010-04-18 17:34 ` Richard Guenther
  2010-04-18 18:02   ` Jan Hubicka
  2010-07-16 15:32 ` H.J. Lu
  1 sibling, 1 reply; 5+ messages in thread
From: Richard Guenther @ 2010-04-18 17:34 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: gcc-patches

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 { .. }.

Richard.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Handle flattening in early inliner
  2010-04-18 17:34 ` Richard Guenther
@ 2010-04-18 18:02   ` Jan Hubicka
  2010-04-18 21:51     ` Richard Guenther
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Hubicka @ 2010-04-18 18:02 UTC (permalink / raw)
  To: Richard Guenther; +Cc: Jan Hubicka, gcc-patches

> 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)
> >

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Handle flattening in early inliner
  2010-04-18 18:02   ` Jan Hubicka
@ 2010-04-18 21:51     ` Richard Guenther
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Guenther @ 2010-04-18 21:51 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: gcc-patches

2010/4/18 Jan Hubicka <hubicka@ucw.cz>:
>> 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.

Ah, ok - but then you should technically increase iteration by one ;)

Well, it is not big deal as you say.

Richard.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Handle flattening in early inliner
  2010-04-17 23:49 Handle flattening in early inliner Jan Hubicka
  2010-04-18 17:34 ` Richard Guenther
@ 2010-07-16 15:32 ` H.J. Lu
  1 sibling, 0 replies; 5+ messages in thread
From: H.J. Lu @ 2010-07-16 15:32 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: gcc-patches

On Sat, Apr 17, 2010 at 4:44 PM, 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.

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44964

-- 
H.J.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-07-16 15:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-17 23:49 Handle flattening in early inliner Jan Hubicka
2010-04-18 17:34 ` Richard Guenther
2010-04-18 18:02   ` Jan Hubicka
2010-04-18 21:51     ` Richard Guenther
2010-07-16 15:32 ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).