This is the mail archive of the gcc-patches@gcc.gnu.org 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]

[PATCH] Fix PR50823 and its gazillion dups


This removes accounting for the number of remaining calls in
the inlining edge badness calculation (as discussed in private
with Honza a long time ago - and yes, we disagreed).  This
fixes the various ICEs of the edge badness update and caching
code checking which are now present for over one month.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
A SPEC 2k6 LTO run is also in progress where I hope it will fix
the 403.gcc and 435.gromacs builds which fail with the same
ICE since a month.

Honza, I guess you have some 12h to come up with a different fix now ;)

The patch enables simplifying the edge badness recalculation code
and possibly will speed it up.

Thanks,
Richard.

2011-12-06  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/50823
	* ipa-inline.c (edge_badness): Do not account for the number of
	remaining calls.

	* gcc.dg/torture/pr50823.c: New testcase.

Index: gcc/ipa-inline.c
===================================================================
--- gcc/ipa-inline.c	(revision 182044)
+++ gcc/ipa-inline.c	(working copy)
@@ -808,7 +808,6 @@ edge_badness (struct cgraph_edge *edge,
   else if (flag_guess_branch_prob)
     {
       int div = edge->frequency * (1<<10) / CGRAPH_FREQ_MAX;
-      int growth_for_all;
 
       div = MAX (div, 1);
       gcc_checking_assert (edge->frequency <= CGRAPH_FREQ_MAX);
@@ -846,14 +845,12 @@ edge_badness (struct cgraph_edge *edge,
 	  if (dump)
 	    fprintf (dump_file, "Badness overflow\n");
 	}
-      growth_for_all = estimate_growth (callee);
-      badness += growth_for_all;
       if (dump)
 	{
 	  fprintf (dump_file,
-		   "      %i: guessed profile. frequency %f, overall growth %i,"
+		   "      %i: guessed profile. frequency %f,"
 		   " benefit %f%%, divisor %i\n",
-		   (int) badness, (double)edge->frequency / CGRAPH_FREQ_BASE, growth_for_all,
+		   (int) badness, (double)edge->frequency / CGRAPH_FREQ_BASE,
 		   relative_time_benefit (callee_info, edge, time_growth) * 100 / 256.0, div);
 	}
     }
Index: gcc/testsuite/gcc.dg/torture/pr50823.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/pr50823.c	(revision 0)
+++ gcc/testsuite/gcc.dg/torture/pr50823.c	(revision 0)
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-options "-finline-functions" } */
+
+int k1, k2, k3, k4, k5, k6, k7, k8;
+
+void set_first_insn (int);
+void set_last_insn (void);
+
+static int make_insn_raw (void) 
+{
+  set_first_insn (0);
+  set_last_insn ();
+  return k1;
+}
+
+static void add_insn_after (void)
+{
+  if (k2)
+    k3 = k4;
+
+  if (k5)
+    k6 = k7;
+}
+
+void emit_pattern_after_noloc (int (make_raw) (void)) 
+{
+  if (k8)
+    {
+      make_raw ();
+      add_insn_after ();
+    }
+}
+
+void emit_insn_after_noloc (void)
+{
+  emit_pattern_after_noloc (make_insn_raw);
+}
+
+void emit_debug_insn_before_setloc (int k9)
+{
+  if (k9)
+    make_insn_raw ();
+}


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