PR lto/53604 (incorrectly optmized out comdats)

Submitted by Jan Hubicka on June 26, 2012, 10:23 a.m.

Details

Message ID 20120626102310.GE30713@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka June 26, 2012, 10:23 a.m.
Hi,
this patch solves problem where comdat symbols are incorrectly optimized out even if used from
object file.  With V1 plugin API this will lead to unnecesary symbols kept in the object file.
I am not sure how important it is, since they are not that common. 

I will backport this to 4.7 if Mozilla will build well with V1 API.

Honza

Bootstrapped/regtested x86_64-linux, comitted.

    PR lto/53572
    * cgraph.h (varpool_can_remove_if_no_refs): Fix handling of
    used symbols.

Patch hide | download patch | download mbox

--- trunk/gcc/cgraph.h	2012/06/26 10:13:11	188981
+++ trunk/gcc/cgraph.h	2012/06/26 10:15:18	188982
@@ -1126,7 +1126,8 @@ 
   if (DECL_EXTERNAL (node->symbol.decl))
     return true;
   return (!node->symbol.force_output && !node->symbol.used_from_other_partition
-  	  && (DECL_COMDAT (node->symbol.decl)
+  	  && ((DECL_COMDAT (node->symbol.decl)
+	       && !symtab_used_from_object_file_p ((symtab_node) node))
 	      || !node->symbol.externally_visible
 	      || DECL_HAS_VALUE_EXPR_P (node->symbol.decl)));
 }