aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2012-05-17 16:37:33 +0000
committerJan Hubicka <jh@suse.cz>2012-05-17 16:37:33 +0000
commit8b5aa709baaac3fbc8182229773eba8cb8c7fc25 (patch)
treec091b61bf18ed877244605adef29bd8f35c140b1 /gcc/lto
parent3dca45fe8fc1d6c8fae7da8942716e53ea37d2bf (diff)
* lto-symtab.c (lto_symtab_resolve_symbols): Preffer decl with constructor
over decl without. * cgraph.c (cgraph_remove_node): Clear also body of unanalyzed nodes. * cgraph.h (varpool_can_remove_if_no_refs): Handle external correctly. * cgraphunit.c (process_function_and_variable_attributes): Finalize extrnal decls. (mark_functions_to_output): Also accept bodies for functions with clones. (output_in_order): Skip external vars. * lto-cgraph.c (lto_output_node): External functions are never in other partition. (lto_output_varpool_node): Likewise. * lto-streamer-out.c (lto_write_tree): Always use error_mark_nodes for forgotten initializers. * ipa.c (process_references): Handle external vars. (symtab_remove_unreachable_nodes): Update to handle external vars. (varpool_externally_visible_p): External vars are externally visible. * gimple-fold.c (can_refer_decl_in_current_unit_p): Update. * varpool.c (varpool_remove_node): Remove constructor. (decide_is_variable_needed): Handle externals. (varpool_remove_unreferenced_decls): Likewise. * lto-partition.c (add_references_to_partition): Handle external vars. (partition_varpool_node_p): Likewise. (lto_promote_cross_file_statics): Do not promote externals. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@187631 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto')
-rw-r--r--gcc/lto/ChangeLog6
-rw-r--r--gcc/lto/lto-partition.c10
2 files changed, 14 insertions, 2 deletions
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 6edc2afbc82..04d4d03ee5b 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,9 @@
+2012-05-17 Jan Hubicka <jh@suse.cz>
+
+ * lto-partition.c (add_references_to_partition): Handle external vars.
+ (partition_varpool_node_p): Likewise.
+ (lto_promote_cross_file_statics): Do not promote externals.
+
2012-05-14 Bernd Schmidt <bernds@codesourcery.com>
* lto-lang.c (handle_fnspec_attribute): New static function.
diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c
index 5c931e682af..602173dd949 100644
--- a/gcc/lto/lto-partition.c
+++ b/gcc/lto/lto-partition.c
@@ -83,6 +83,7 @@ add_references_to_partition (ltrans_partition part, struct ipa_ref_list *refs)
else
if (symtab_variable_p (ref->referred)
&& (DECL_COMDAT (ipa_ref_varpool_node (ref)->symbol.decl)
+ || DECL_EXTERNAL (ipa_ref_varpool_node (ref)->symbol.decl)
|| (ref->use == IPA_REF_ALIAS
&& lookup_attribute
("weakref",
@@ -287,6 +288,7 @@ partition_varpool_node_p (struct varpool_node *vnode)
return false;
/* Constant pool and comdat are always only in partitions they are needed. */
if (DECL_IN_CONSTANT_POOL (vnode->symbol.decl)
+ || DECL_EXTERNAL (vnode->symbol.decl)
|| (DECL_COMDAT (vnode->symbol.decl)
&& !vnode->symbol.force_output
&& !symtab_used_from_object_file_p ((symtab_node) vnode)))
@@ -843,6 +845,7 @@ lto_promote_cross_file_statics (void)
be made global. It is sensible to keep those ltrans local to
allow better optimization. */
if (!DECL_IN_CONSTANT_POOL (vnode->symbol.decl)
+ && !DECL_EXTERNAL (vnode->symbol.decl)
&& !DECL_COMDAT (vnode->symbol.decl)
&& !vnode->symbol.externally_visible && vnode->analyzed
&& referenced_from_other_partition_p (&vnode->symbol.ref_list,
@@ -893,8 +896,11 @@ lto_promote_cross_file_statics (void)
/* Constant pool references use internal labels and thus
cannot be made global. It is sensible to keep those
- ltrans local to allow better optimization. */
- if (DECL_IN_CONSTANT_POOL (v->symbol.decl))
+ ltrans local to allow better optimization.
+ Similarly we ship external vars initializers into
+ every ltrans unit possibly referring to it. */
+ if (DECL_IN_CONSTANT_POOL (v->symbol.decl)
+ || DECL_EXTERNAL (v->symbol.decl))
{
if (!pointer_set_insert (inserted, vnode))
VEC_safe_push (varpool_node_ptr, heap,