[GOOGLE] Unrestrict early inline restrictions for AutoFDO

Submitted by Dehao Chen on May 29, 2013, 4:39 p.m.

Details

Message ID CAO2gOZVq76GUFzY5i=EsgS6CjD+_S1tiwN9EyoWLF3nr=OvE8Q@mail.gmail.com
State New
Headers show

Commit Message

Dehao Chen May 29, 2013, 4:39 p.m.
In gcc4-8, the max einline iterations are restricted to 1. For
AutoFDO, this is bad because early inline is not size restricted. This
patch allows einline to do multiple iterations in AutoFDO. It also
enables tracer optimization in AutoFDO.

Bootstrapped and passed regression test.

OK for googel-4_8?

Thanks,
Dehao

Comments

Xinliang David Li May 29, 2013, 5 p.m.
The early inlining part is ok. The tracer optimization should be
revisited -- we should have more fine grain control on it (for
instance, based on FDO summary -- but that should be common to
FDO/LIPO).

David

On Wed, May 29, 2013 at 9:39 AM, Dehao Chen <dehao@google.com> wrote:
> In gcc4-8, the max einline iterations are restricted to 1. For
> AutoFDO, this is bad because early inline is not size restricted. This
> patch allows einline to do multiple iterations in AutoFDO. It also
> enables tracer optimization in AutoFDO.
>
> Bootstrapped and passed regression test.
>
> OK for googel-4_8?
>
> Thanks,
> Dehao
>
> Index: gcc/ipa-inline.c
> ===================================================================
> --- gcc/ipa-inline.c (revision 199416)
> +++ gcc/ipa-inline.c (working copy)
> @@ -2161,7 +2161,8 @@ early_inliner (void)
>      {
>        /* We iterate incremental inlining to get trivial cases of indirect
>   inlining.  */
> -      while (iterations < PARAM_VALUE (PARAM_EARLY_INLINER_MAX_ITERATIONS)
> +      while ((flag_auto_profile
> +      || iterations < PARAM_VALUE (PARAM_EARLY_INLINER_MAX_ITERATIONS))
>       && early_inline_small_functions (node))
>   {
>    timevar_push (TV_INTEGRATION);
> Index: gcc/opts.c
> ===================================================================
> --- gcc/opts.c (revision 199416)
> +++ gcc/opts.c (working copy)
> @@ -1644,6 +1644,8 @@ common_handle_option (struct gcc_options *opts,
>   opts->x_flag_peel_loops = value;
>        if (!opts_set->x_flag_value_profile_transformations)
>   opts->x_flag_value_profile_transformations = value;
> +      if (!opts_set->x_flag_tracer)
> + opts->x_flag_tracer = value;
>        if (!opts_set->x_flag_inline_functions)
>   opts->x_flag_inline_functions = value;
>        if (!opts_set->x_flag_ipa_cp)
Dehao Chen May 29, 2013, 10:44 p.m.
OK, I'll commit the early inline part.

Dehao

On Wed, May 29, 2013 at 10:00 AM, Xinliang David Li <davidxl@google.com> wrote:
> The early inlining part is ok. The tracer optimization should be
> revisited -- we should have more fine grain control on it (for
> instance, based on FDO summary -- but that should be common to
> FDO/LIPO).
>
> David
>
> On Wed, May 29, 2013 at 9:39 AM, Dehao Chen <dehao@google.com> wrote:
>> In gcc4-8, the max einline iterations are restricted to 1. For
>> AutoFDO, this is bad because early inline is not size restricted. This
>> patch allows einline to do multiple iterations in AutoFDO. It also
>> enables tracer optimization in AutoFDO.
>>
>> Bootstrapped and passed regression test.
>>
>> OK for googel-4_8?
>>
>> Thanks,
>> Dehao
>>
>> Index: gcc/ipa-inline.c
>> ===================================================================
>> --- gcc/ipa-inline.c (revision 199416)
>> +++ gcc/ipa-inline.c (working copy)
>> @@ -2161,7 +2161,8 @@ early_inliner (void)
>>      {
>>        /* We iterate incremental inlining to get trivial cases of indirect
>>   inlining.  */
>> -      while (iterations < PARAM_VALUE (PARAM_EARLY_INLINER_MAX_ITERATIONS)
>> +      while ((flag_auto_profile
>> +      || iterations < PARAM_VALUE (PARAM_EARLY_INLINER_MAX_ITERATIONS))
>>       && early_inline_small_functions (node))
>>   {
>>    timevar_push (TV_INTEGRATION);
>> Index: gcc/opts.c
>> ===================================================================
>> --- gcc/opts.c (revision 199416)
>> +++ gcc/opts.c (working copy)
>> @@ -1644,6 +1644,8 @@ common_handle_option (struct gcc_options *opts,
>>   opts->x_flag_peel_loops = value;
>>        if (!opts_set->x_flag_value_profile_transformations)
>>   opts->x_flag_value_profile_transformations = value;
>> +      if (!opts_set->x_flag_tracer)
>> + opts->x_flag_tracer = value;
>>        if (!opts_set->x_flag_inline_functions)
>>   opts->x_flag_inline_functions = value;
>>        if (!opts_set->x_flag_ipa_cp)

Patch hide | download patch | download mbox

Index: gcc/ipa-inline.c
===================================================================
--- gcc/ipa-inline.c (revision 199416)
+++ gcc/ipa-inline.c (working copy)
@@ -2161,7 +2161,8 @@  early_inliner (void)
     {
       /* We iterate incremental inlining to get trivial cases of indirect
  inlining.  */
-      while (iterations < PARAM_VALUE (PARAM_EARLY_INLINER_MAX_ITERATIONS)
+      while ((flag_auto_profile
+      || iterations < PARAM_VALUE (PARAM_EARLY_INLINER_MAX_ITERATIONS))
      && early_inline_small_functions (node))
  {
   timevar_push (TV_INTEGRATION);
Index: gcc/opts.c
===================================================================
--- gcc/opts.c (revision 199416)
+++ gcc/opts.c (working copy)
@@ -1644,6 +1644,8 @@  common_handle_option (struct gcc_options *opts,
  opts->x_flag_peel_loops = value;
       if (!opts_set->x_flag_value_profile_transformations)
  opts->x_flag_value_profile_transformations = value;
+      if (!opts_set->x_flag_tracer)
+ opts->x_flag_tracer = value;
       if (!opts_set->x_flag_inline_functions)
  opts->x_flag_inline_functions = value;
       if (!opts_set->x_flag_ipa_cp)