This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
4.6: do not divide by 0 on insane profile
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 25 May 2011 13:38:23 +0200
- Subject: 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))
{