aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-fold.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2012-05-17 18:37:33 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2012-05-17 16:37:33 +0000
commit6649df51ec79ed1ffe81dc8b93b7fc8cce85040f (patch)
treec091b61bf18ed877244605adef29bd8f35c140b1 /gcc/gimple-fold.c
parentf9eead1f8953869fcfd8be7b0e58aff50fbe1fd5 (diff)
downloadgcc-6649df51ec79ed1ffe81dc8b93b7fc8cce85040f.zip
gcc-6649df51ec79ed1ffe81dc8b93b7fc8cce85040f.tar.gz
gcc-6649df51ec79ed1ffe81dc8b93b7fc8cce85040f.tar.bz2
lto-symtab.c (lto_symtab_resolve_symbols): Preffer decl with constructor over decl without.
* 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. From-SVN: r187631
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r--gcc/gimple-fold.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index b6f0143..dbe1b83 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -62,18 +62,11 @@ can_refer_decl_in_current_unit_p (tree decl)
if (!TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
return true;
/* External flag is set, so we deal with C++ reference
- to static object from other file. */
+ to static object from other file.
+ We also may see weakref that is always safe. */
if (DECL_EXTERNAL (decl) && TREE_STATIC (decl)
&& TREE_CODE (decl) == VAR_DECL)
- {
- /* Just be sure it is not big in frontend setting
- flags incorrectly. Those variables should never
- be finalized. */
- gcc_checking_assert (!(vnode = varpool_get_node (decl))
- || vnode->alias
- || !vnode->finalized);
- return false;
- }
+ return lookup_attribute ("weakref", DECL_ATTRIBUTES (decl)) != NULL;
/* When function is public, we always can introduce new reference.
Exception are the COMDAT functions where introducing a direct
reference imply need to include function body in the curren tunit. */