Clear calls_comdat_local when comdat group is dissolved

Message ID 20191203183540.zq4r34nzct7diri5@kam.mff.cuni.cz
State New
Headers show
Series
  • Clear calls_comdat_local when comdat group is dissolved
Related show

Commit Message

Jan Hubicka Dec. 3, 2019, 6:35 p.m.
Hi,
while looking into Firefox inlining dumps I noticed that we often do not
inline because we think function calls comdat local while the comdat group
itself has been dissolved.

Bootstrapped/regtested x86_64-linux, comitted.

	* cgraph.c (cgraph_node::verify_node): Check that calls_comdat_local
	is set only for symbol in comdat group.
	* symtab.c (symtab_node::dissolve_same_comdat_group_1): Clear it.

Patch

Index: cgraph.c
===================================================================
--- cgraph.c	(revision 278904)
+++ cgraph.c	(working copy)
@@ -3093,6 +3094,11 @@  cgraph_node::verify_node (void)
       error ("inline clone is forced to output");
       error_found = true;
     }
+  if (calls_comdat_local && !same_comdat_group)
+    {
+      error ("calls_comdat_local is set outside of a comdat group");
+      error_found = true;
+    }
   for (e = indirect_calls; e; e = e->next_callee)
     {
       if (e->aux)
Index: symtab.c
===================================================================
--- symtab.c	(revision 278904)
+++ symtab.c	(working copy)
@@ -489,6 +489,8 @@  symtab_node::dissolve_same_comdat_group_
     {
       next = n->same_comdat_group;
       n->same_comdat_group = NULL;
+      if (dyn_cast <cgraph_node *> (n))
+	dyn_cast <cgraph_node *> (n)->calls_comdat_local = false;
       /* Clear comdat_group for comdat locals, since
          make_decl_local doesn't.  */
       if (!TREE_PUBLIC (n->decl))