Patchwork 4.6: do not divide by 0 on insane profile

login
register
mail settings
Submitter Jan Hubicka
Date May 25, 2011, 11:38 a.m.
Message ID <20110525113823.GF17175@kam.mff.cuni.cz>
Download mbox | patch
Permalink /patch/97338/
State New
Headers show

Comments

Jan Hubicka - May 25, 2011, 11:38 a.m.
Hi,
cgraph_decide_recursive_inlining may decide to divide by 0 when profile is read
but it is small enough, so even count of 0 is considered as possibly hot.  This
particularly happens when profile was not really read after all.

The problem is fixed on mainline differently. This patch just obviously plugs
the symptom.

Bootstrapped/regtested x86_64-linux, comitted.

Patch

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 174182)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@ 
+2011-05-18  Jan Hubicka  <jh@suse.cz>
+
+	PR tree-optimization/44897 
+	* ipa-inline.c (cgraph_decide_recursive_inlining): Do not divide
+	by zero for insane profiles.
+
 2011-05-24  Eric Botcazou  <ebotcazou@adacore.com>
 
 	* config/sparc/sparc.c (sparc_option_override): If not set by the user,
Index: ipa-inline.c
===================================================================
--- ipa-inline.c	(revision 173893)
+++ ipa-inline.c	(working copy)
@@ -895,7 +895,7 @@  cgraph_decide_recursive_inlining (struct
 	  continue;
 	}
 
-      if (max_count)
+      if (max_count && node->count)
 	{
           if (!cgraph_maybe_hot_edge_p (curr))
 	    {