]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cgraph: Do not warn about caller count mismatches of removed functions
authorMartin Jambor <mjambor@suse.cz>
Thu, 16 Sep 2021 12:04:06 +0000 (14:04 +0200)
committerMartin Jambor <mjambor@suse.cz>
Thu, 16 Sep 2021 15:06:47 +0000 (17:06 +0200)
To verify other changes in the patch series, I have been searching for
"Invalid sum of caller counts" string in symtab dump but found that
there are false warnings about functions which have their body removed
because they are now unreachable.  Those are of course invalid and so
this patches avoids checking such cgraph_nodes.

gcc/ChangeLog:

2021-08-20  Martin Jambor  <mjambor@suse.cz>

* cgraph.c (cgraph_node::dump): Do not check caller count sums if
the body has been removed.  Remove trailing whitespace.

gcc/cgraph.c

index 8f3af003f2af96422585390c5e7adf55f52ec54b..de0786537814690bf7e841500be532e96f62132a 100644 (file)
@@ -2236,7 +2236,7 @@ cgraph_node::dump (FILE *f)
     }
   fprintf (f, "\n");
 
-  if (count.ipa ().initialized_p ())
+  if (!body_removed && count.ipa ().initialized_p ())
     {
       bool ok = true;
       bool min = false;
@@ -2245,7 +2245,7 @@ cgraph_node::dump (FILE *f)
       FOR_EACH_ALIAS (this, ref)
        if (dyn_cast <cgraph_node *> (ref->referring)->count.initialized_p ())
          sum += dyn_cast <cgraph_node *> (ref->referring)->count.ipa ();
-  
+
       if (inlined_to
          || (symtab->state < EXPANSION
              && ultimate_alias_target () == this && only_called_directly_p ()))