diff mbox

[google] Increase inlining limits with FDO/LIPO

Message ID BANLkTi=UyKyTO7qWXoG9dFz8Ki179C4puw@mail.gmail.com
State New
Headers show

Commit Message

Mark Heffernan May 18, 2011, 5:55 a.m. UTC
This small patch greatly expands the function size limits for inlining
with FDO/LIPO.  With profile information, the inliner is much more
selective and precise and so the limits can be increased with less
worry that functions and total code size will blow up.  This speeds up
x86-64 internal benchmarks by about geomean 1.5% to 3% with LIPO
(depending on microarch), and 1% to 1.5% with FDO.  Size increase is
negligible (0.1% mean).

Bootstrapped and regression tested on x86-64.

Trunk testing to follow.

Ok for google/main?

Mark


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

       * opts.c (finish_options): Increase inlining limits with profile
       generate and use.
diff mbox

Patch

Index: opts.c
===================================================================
--- opts.c	(revision 173666)
+++ opts.c	(working copy)
@@ -828,6 +828,22 @@  finish_options (struct gcc_options *opts
 	  opts->x_flag_split_stack = 0;
 	}
     }
+
+  if (opts->x_flag_profile_use
+      || opts->x_profile_arc_flag
+      || opts->x_flag_profile_values)
+    {
+      /* With accurate profile information, inlining is much more
+	 selective and makes better decisions, so increase the
+	 inlining function size limits.  Changes must be added to both
+	 the generate and use builds to avoid profile mismatches.  */
+      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);
+    }
 }