2009-11-11 Jan Hubicka <jh@suse.cz>
+ PR middle-end/41729
+ * ipa.c (function_and_variable_visibility): Do not privatize COMDAT
+ and WEAK variables at -fwhole-program.
+
+ PR middle-end/41735
+ * ipa.c (whole_program_function_and_variable_visility): COMDAT
+ functions/variables are not needed even if they are externally visible.
+
+2009-11-11 Jan Hubicka <jh@suse.cz>
+
(patch by Richard Guenther)
* lto-streamer-out.c (output_function): Output head of argument list
earlier.
if (vnode->needed
&& (DECL_COMDAT (vnode->decl) || TREE_PUBLIC (vnode->decl))
&& (!whole_program
+ /* We can privatize comdat readonly variables whose address is not taken,
+ but doing so is not going to bring us optimization oppurtunities until
+ we start reordering datastructures. */
+ || DECL_COMDAT (vnode->decl)
+ || DECL_WEAK (vnode->decl)
|| lookup_attribute ("externally_visible",
DECL_ATTRIBUTES (vnode->decl))))
vnode->externally_visible = true;
function_and_variable_visibility (flag_whole_program);
for (node = cgraph_nodes; node; node = node->next)
- if (node->local.externally_visible && node->local.finalized)
+ if ((node->local.externally_visible && !DECL_COMDAT (node->decl))
+ && node->local.finalized)
cgraph_mark_needed_node (node);
for (vnode = varpool_nodes_queue; vnode; vnode = vnode->next_needed)
- if (vnode->externally_visible)
+ if (vnode->externally_visible && !DECL_COMDAT (vnode->decl))
varpool_mark_needed_node (vnode);
return 0;
}