https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83619

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Leaving to Honza. There's patch that fixes another issue (w/ -fdump-ipa-inline)
+ better diagnostics:

diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 69eb9bb2341..780769f07ee 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -3239,6 +3239,8 @@ cgraph_node::verify_node (void)
              && e->count.differs_from_p (gimple_bb (e->call_stmt)->count)))
        {
          error ("caller edge count does not match BB count");
+         fprintf (stderr, "edge: %s->%s\n", e->caller->name(),
+                  e->callee->name ());
          fprintf (stderr, "edge count: ");
          e->count.dump (stderr);
          fprintf (stderr, "\n bb count: ");
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index c535a9ab7d6..c62f9fe3835 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -1481,8 +1481,7 @@ recursive_inlining (struct cgraph_edge *edge,
          if (node->count.nonzero_p ())
            {
              fprintf (dump_file, " called approx. %.2f times per call",
-                      (double)curr->count.to_gcov_type ()
-                      / node->count.to_gcov_type ());
+                      curr->sreal_frequency ().to_double ());
            }
          fprintf (dump_file, "\n");
        }

What's for me confusing is that cgraph_edge::sreal_frequency returns 1
for situations where count == uninitialized. Thus we're assuming that a call
happens every time when we don't have estimation. Another question I have:
Why do we have so many edges with count == unitialized after we do local
estimation of counts?

Reply via email to