]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/ipa-inline.c
PR ipa/85051
[thirdparty/gcc.git] / gcc / ipa-inline.c
index f37cd9da26d85d610584a97632e9d0460652c08b..745bdf3002a65382d20fc3fe91cf708bf6bc587c 100644 (file)
@@ -2134,7 +2134,7 @@ inline_small_functions (void)
    at IPA inlining time.  */
 
 static void
-flatten_function (struct cgraph_node *node, bool early)
+flatten_function (struct cgraph_node *node, bool early, bool update)
 {
   struct cgraph_edge *e;
 
@@ -2164,7 +2164,7 @@ flatten_function (struct cgraph_node *node, bool early)
         it in order to fully flatten the leaves.  */
       if (!e->inline_failed)
        {
-         flatten_function (callee, early);
+         flatten_function (callee, early, false);
          continue;
        }
 
@@ -2204,14 +2204,15 @@ flatten_function (struct cgraph_node *node, bool early)
       inline_call (e, true, NULL, NULL, false);
       if (e->callee != orig_callee)
        orig_callee->aux = (void *) node;
-      flatten_function (e->callee, early);
+      flatten_function (e->callee, early, false);
       if (e->callee != orig_callee)
        orig_callee->aux = NULL;
     }
 
   node->aux = NULL;
-  if (!node->global.inlined_to)
-    ipa_update_overall_fn_summary (node);
+  if (update)
+    ipa_update_overall_fn_summary (node->global.inlined_to
+                                  ? node->global.inlined_to : node);
 }
 
 /* Inline NODE to all callers.  Worker for cgraph_for_node_and_aliases.
@@ -2519,7 +2520,7 @@ ipa_inline (void)
         function.  */
       if (dump_file)
        fprintf (dump_file, "Flattening %s\n", node->name ());
-      flatten_function (node, false);
+      flatten_function (node, false, true);
     }
 
   if (j < nnodes - 2)
@@ -2782,7 +2783,7 @@ early_inliner (function *fun)
       if (dump_enabled_p ())
        dump_printf (MSG_OPTIMIZED_LOCATIONS,
                     "Flattening %C\n", node);
-      flatten_function (node, true);
+      flatten_function (node, true, true);
       inlined = true;
     }
   else