]> gcc.gnu.org Git - gcc.git/commitdiff
Fix g++.dg/torture/pr59226.C
authorJan Hubicka <hubicka@ucw.cz>
Thu, 5 Dec 2019 20:53:39 +0000 (21:53 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Thu, 5 Dec 2019 20:53:39 +0000 (20:53 +0000)
this patch fixes ICE in g++.dg/torture/pr59226.C which was triggered by
new comdat_local sanity check.  What happens here is that function gets
inlined into its own thunk which makes it !comdat_local_p but the updating
code does not notice since thunk calls comdat local alias of the function
itself and we look at alias target rather than original callee.

This also shows that we miss optimization here.  Currently we will not inline
thunk out of its comdat local group w/o inlining function it is associated with
into it.

We should teach inline_call to reoslve edges to aliases while inlining and
relax calls_comdat_local flag.  But this needs bit more work, so I fix the
ICE first.

* ipa-inline-transform.c (inline_call): Fix maintenatnce of comdat_local

From-SVN: r279021

gcc/ChangeLog
gcc/ipa-inline-transform.c

index 3cd05387def0c69157fe87976df4393cafe54319..ab19c525fb28cb225b984105c1fe1e82e0776741 100644 (file)
@@ -1,3 +1,7 @@
+2019-12-05  Jan Hubicka  <hubicka@ucw.cz>
+
+       * ipa-inline-transform.c (inline_call): Fix maintenatnce of comdat_local
+
 2019-12-05  Jan Hubicka  <hubicka@ucw.cz>
 
        * cgraphclones.c (localize_profile): New function.
index 6ec843a23b7666b048b0d6e38c4f2d7b30e03c2f..fb2726d72f5d4895300473517d87816a157543e0 100644 (file)
@@ -331,6 +331,7 @@ inline_call (struct cgraph_edge *e, bool update_original,
   int old_size = 0, new_size = 0;
   struct cgraph_node *to = NULL;
   struct cgraph_edge *curr = e;
+  bool comdat_local = e->callee->comdat_local_p ();
   struct cgraph_node *callee = e->callee->ultimate_alias_target ();
   bool new_edges_found = false;
 
@@ -502,7 +503,7 @@ inline_call (struct cgraph_edge *e, bool update_original,
 
   if (callee->calls_comdat_local)
     to->calls_comdat_local = true;
-  else if (to->calls_comdat_local && callee->comdat_local_p ())
+  else if (to->calls_comdat_local && comdat_local)
     {
       struct cgraph_edge *se = to->callees;
       for (; se; se = se->next_callee)
This page took 0.0932460000000001 seconds and 5 git commands to generate.