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

--- Comment #7 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
It is an ordering issue. We are adding edges to heap and resolving speculations
at once that means that we have temporarily wrong summaries. I am testing the
following that should not affect codegen in any important way except for random
changes of functions with the same priority.

Index: ipa-inline.c
===================================================================
--- ipa-inline.c        (revision 220417)
+++ ipa-inline.c        (working copy)
@@ -1702,6 +1702,7 @@ inline_small_functions (void)
     {
       bool update = false;
       struct cgraph_edge *next;
+      bool has_speculative = false;

       if (dump_file)
        fprintf (dump_file, "Enqueueing calls in %s/%i.\n",
@@ -1719,12 +1720,17 @@ inline_small_functions (void)
              gcc_assert (!edge->aux);
              update_edge_key (&edge_heap, edge);
            }
-         if (edge->speculative && !speculation_useful_p (edge, edge->aux !=
NULL))
+         if (edge->speculative)
+           has_speculative = true;
+       }
+      if (has_speculative)
+       for (edge = node->callees; edge; edge = next)
+         if (edge->speculative && !speculation_useful_p (edge,
+                                                         edge->aux != NULL))
            {
              edge->resolve_speculation ();
              update = true;
            }
-       }
       if (update)
        {
          struct cgraph_node *where = node->global.inlined_to

Reply via email to