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

--- Comment #5 from Jan Hubicka <hubicka at ucw dot cz> ---
Hi,
I reproduced the firefox ICE now (it needs -O3 instead of default flags). I am
testing
the following patch which fixes some confusion between thunk and non-thunk
inline clones
(there can be both, because we can first inline thunk, then inline into thunk
and then
inline the whole thing again)


Index: ipa-inline-transform.c
===================================================================
--- ipa-inline-transform.c      (revision 236275)
+++ ipa-inline-transform.c      (working copy)
@@ -587,9 +587,10 @@ preserve_function_body_p (struct cgraph_
   gcc_assert (symtab->global_info_ready);
   gcc_assert (!node->alias && !node->thunk.thunk_p);

-  /* Look if there is any clone around.  */
-  if (node->clones && !node->clones->thunk.thunk_p)
-    return true;
+  /* Look if there is any non-thunk clone around.  */
+  for (node = node->clones; node; node = node->next_sibling_clone)
+    if (!node->thunk.thunk_p)
+      return true;
   return false;
 }

Index: lto-cgraph.c
===================================================================
--- lto-cgraph.c        (revision 236275)
+++ lto-cgraph.c        (working copy)
@@ -259,7 +259,7 @@ lto_output_edge (struct lto_simple_outpu
   streamer_write_gcov_count_stream (ob->main_stream, edge->count);

   bp = bitpack_create (ob->main_stream);
-  uid = (!gimple_has_body_p (edge->caller->decl)
+  uid = (!gimple_has_body_p (edge->caller->decl) ||
edge->caller->thunk.thunk_p
         ? edge->lto_stmt_uid : gimple_uid (edge->call_stmt) + 1);
   bp_pack_enum (&bp, cgraph_inline_failed_t,
                CIF_N_REASONS, edge->inline_failed);
Index: lto-streamer-in.c
===================================================================
--- lto-streamer-in.c   (revision 236275)
+++ lto-streamer-in.c   (working copy)
@@ -952,20 +952,21 @@ fixup_call_stmt_edges (struct cgraph_nod
   fixup_call_stmt_edges_1 (orig, stmts, fn);
   if (orig->clones)
     for (node = orig->clones; node != orig;)
-      {
-       fixup_call_stmt_edges_1 (node, stmts, fn);
-       if (node->clones)
-         node = node->clones;
-       else if (node->next_sibling_clone)
-         node = node->next_sibling_clone;
-       else
-         {
-           while (node != orig && !node->next_sibling_clone)
-             node = node->clone_of;
-           if (node != orig)
-             node = node->next_sibling_clone;
-         }
-      }
+      if (!node->thunk.thunk_p)
+       {
+         fixup_call_stmt_edges_1 (node, stmts, fn);
+         if (node->clones)
+           node = node->clones;
+         else if (node->next_sibling_clone)
+           node = node->next_sibling_clone;
+         else
+           {
+             while (node != orig && !node->next_sibling_clone)
+               node = node->clone_of;
+             if (node != orig)
+               node = node->next_sibling_clone;
+           }
+       }
 }

Reply via email to