[google] Increase inlining limits with FDO/LIPO

Mark Heffernan meheff@google.com
Wed May 18 18:37:00 GMT 2011


On Tue, May 17, 2011 at 11:34 PM, Xinliang David Li <davidxl@google.com> wrote:
> flag_profile_arcs and flag_branch_probabilities.  -fprofile-use
> enables profile-arcs, and value profiling is enabled only when
> edge/branch profiling is enabled (so no need to be checked).

I changed the location where these parameters are set to someplace
more appropriate (to where the flags are set when profile gen/use is
indicated).  Verified identical binaries are generated.

OK as updated?

Mark

2011-05-18  Mark Heffernan  <meheff@google.com>

        * opts.c (set_profile_parameters): New function.


Index: opts.c
===================================================================
--- opts.c      (revision 173666)
+++ opts.c      (working copy)
@@ -1209,6 +1209,25 @@ print_specific_help (unsigned int includ
                       opts->x_help_columns, opts, lang_mask);
 }

+
+/* Set parameters to more appropriate values when profile information
+   is available.  */
+static void
+set_profile_parameters (struct gcc_options *opts,
+                       struct gcc_options *opts_set)
+{
+  /* With accurate profile information, inlining is much more
+     selective and makes better decisions, so increase the
+     inlining function size limits.  */
+  maybe_set_param_value
+    (PARAM_MAX_INLINE_INSNS_SINGLE, 1000,
+     opts->x_param_values, opts_set->x_param_values);
+  maybe_set_param_value
+    (PARAM_MAX_INLINE_INSNS_AUTO, 1000,
+     opts->x_param_values, opts_set->x_param_values);
+}
+
+
 /* Handle target- and language-independent options.  Return zero to
    generate an "unknown option" message.  Only options that need
    extra handling need to be listed here; if you simply want
@@ -1560,6 +1579,7 @@ common_handle_option (struct gcc_options
        opts->x_flag_unswitch_loops = value;
       if (!opts_set->x_flag_gcse_after_reload)
        opts->x_flag_gcse_after_reload = value;
+      set_profile_parameters (opts, opts_set);
       break;

     case OPT_fprofile_generate_:
@@ -1580,6 +1600,7 @@ common_handle_option (struct gcc_options
         is done.  */
       if (!opts_set->x_flag_ipa_reference && in_lto_p)
         opts->x_flag_ipa_reference = false;
+      set_profile_parameters (opts, opts_set);
       break;

     case OPT_fshow_column:



More information about the Gcc-patches mailing list