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]

4.6: do not divide by 0 on insane profile


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.

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))
 	    {


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