This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Another tweak of inline badness metric

this patch adds combined_size (i.e. size of caller after inlining) to the
denominator of the badness metric.  This is based on observations in PR 65076.
Old metric did use relative time speedup to get into sane range with fixed
point math.  I removed this after switching to sreals and this caused quite
noticeable compile time slowdowns on tramp3d and a regression on dromaeo
benchmark of Firefox.

The issue turns out to be the fact that new metric preffer building very
large functions with are not completely cool for optimization and definitely
bad for compile time.

I am comitting the attached patch and plan to watch benchmark results over
the long weekend. If everything goes well, I plan to also increase somewhat
the inline-unit-growth. In GCC 4.9 it is 30%, I dropped it to 15% that seems
too tight for firefox.  Given that large applications was the main motivator
for the drop, I think it is good enough reason to retreat and do not be so
agressive about code size at -O2/-O3.

Bootstrapped/regtested x86_64-linux, will commit it shortly.


	PR ipa/65076
	* ipa-inline.c (edge_badness): Add combined size to the denominator.

Index: ipa-inline.c
--- ipa-inline.c	(revision 221806)
+++ ipa-inline.c	(working copy)
@@ -1077,8 +1077,8 @@ edge_badness (struct cgraph_edge *edge,
   /* When profile is available. Compute badness as:
                  time_saved * caller_count
-     goodness =  ---------------------------------
-	         growth_of_caller * overall_growth
+     goodness =  -------------------------------------------------
+	         growth_of_caller * overall_growth * combined_size
      badness = - goodness
@@ -1167,6 +1167,7 @@ edge_badness (struct cgraph_edge *edge,
 	    overall_growth += 256 * 256 - 256;
 	  denominator *= overall_growth;
+      denominator *= inline_summaries->get (caller)->self_size + growth;
       badness = - numerator / denominator;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]