aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2017-06-12 14:36:47 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2017-06-12 12:36:47 +0000
commit7c41b76e9f61229742328ba95f9085a3460e9a79 (patch)
tree5fcba40cc850e855e1eacc5a9593bf3a08dfc5e7
parent6cddb61ca1c1ed9957217f5f10fb4c79257a5914 (diff)
downloadgcc-7c41b76e9f61229742328ba95f9085a3460e9a79.zip
gcc-7c41b76e9f61229742328ba95f9085a3460e9a79.tar.gz
gcc-7c41b76e9f61229742328ba95f9085a3460e9a79.tar.bz2
* cgraph.c (cgraph_node::dump): Complain about profile insanities.
From-SVN: r249123
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/cgraph.c35
2 files changed, 38 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6193527..20dafd3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2017-06-11 Jan Hubicka <hubicka@ucw.cz>
+
+ * cgraph.c (cgraph_node::dump): Complain about profile insanities.
+
2017-06-12 Doug Rupp <rupp@adacore.com>
* config.gcc (*-*-vxworks*): Set use_gcc_stdint to "provide".
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 213587e..81aed5c 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -2094,7 +2094,7 @@ cgraph_node::dump (FILE *f)
fprintf (f, " Function flags:");
if (count.initialized_p ())
{
- fprintf (f, " profile_count ");
+ fprintf (f, " count: ");
count.dump (f);
}
if (origin)
@@ -2172,10 +2172,13 @@ cgraph_node::dump (FILE *f)
fprintf (f, " Called by: ");
+ profile_count sum = profile_count::zero ();
for (edge = callers; edge; edge = edge->next_caller)
{
fprintf (f, "%s ", edge->caller->dump_name ());
edge->dump_edge_flags (f);
+ if (edge->count.initialized_p ())
+ sum += edge->count;
}
fprintf (f, "\n Calls: ");
@@ -2186,6 +2189,36 @@ cgraph_node::dump (FILE *f)
}
fprintf (f, "\n");
+ if (count.initialized_p ())
+ {
+ bool ok = true;
+ bool min = false;
+ ipa_ref *ref;
+
+ FOR_EACH_ALIAS (this, ref)
+ if (dyn_cast <cgraph_node *> (ref->referring)->count.initialized_p ())
+ sum += dyn_cast <cgraph_node *> (ref->referring)->count;
+
+ if (global.inlined_to
+ || (symtab->state < EXPANSION
+ && ultimate_alias_target () == this && only_called_directly_p ()))
+ ok = !count.differs_from_p (sum);
+ else if (count > profile_count::from_gcov_type (100)
+ && count < sum.apply_scale (99, 100))
+ ok = false, min = true;
+ if (!ok)
+ {
+ fprintf (f, " Invalid sum of caller counts ");
+ sum.dump (f);
+ if (min)
+ fprintf (f, ", should be at most ");
+ else
+ fprintf (f, ", should be ");
+ count.dump (f);
+ fprintf (f, "\n");
+ }
+ }
+
for (edge = indirect_calls; edge; edge = edge->next_callee)
{
if (edge->indirect_info->polymorphic)