Commit 46591697 by Jan Hubicka Committed by Jan Hubicka

re PR lto/54790 (Missing optimization with LTO)


	PR lto/54790 
	* lto.c (resolution_map): New static var.
	(register_resolution): New function.
	(lto_register_var_decl_in_symtab): Use it.
	(read_cgraph_and_symbols): Copy resolutions into the symtab.
	* lto-streamer.h (lto_symtab_register_decl, lto_symtab_get_resolution,
	lto_mark_nothrow_fndecl, lto_fixup_nothrow_decls): Remove.
	* lto-symtab.c (lto_symtab_register_decl): Remove.

From-SVN: r192159
parent 4ed3a4d4
2012-10-06 Jan Hubicka <jh@suse.cz>
PR lto/54790
* lto-streamer.h (lto_symtab_register_decl, lto_symtab_get_resolution,
lto_mark_nothrow_fndecl, lto_fixup_nothrow_decls): Remove.
* lto-symtab.c (lto_symtab_register_decl): Remove.
2012-10-06 Andreas Schwab <schwab@linux-m68k.org>
PR rtl-optimization/54739
......
......@@ -860,12 +860,9 @@ lto_symtab_encoder_t compute_ltrans_boundary (lto_symtab_encoder_t encoder);
/* In lto-symtab.c. */
extern void lto_symtab_register_decl (tree, ld_plugin_symbol_resolution_t,
struct lto_file_decl_data *);
extern void lto_symtab_merge_decls (void);
extern void lto_symtab_merge_cgraph_nodes (void);
extern tree lto_symtab_prevailing_decl (tree decl);
extern enum ld_plugin_symbol_resolution lto_symtab_get_resolution (tree decl);
extern GTY(()) VEC(tree,gc) *lto_global_var_decls;
......@@ -873,11 +870,6 @@ extern GTY(()) VEC(tree,gc) *lto_global_var_decls;
extern void lto_write_options (void);
/* In lto-wpa-fixup.c */
void lto_mark_nothrow_fndecl (tree);
void lto_fixup_nothrow_decls (void);
/* Statistics gathered during LTO, WPA and LTRANS. */
extern struct lto_stats_d lto_stats;
......
......@@ -32,40 +32,6 @@ along with GCC; see the file COPYING3. If not see
/* Vector to keep track of external variables we've seen so far. */
VEC(tree,gc) *lto_global_var_decls;
/* Registers DECL with the LTO symbol table as having resolution RESOLUTION
and read from FILE_DATA. */
void
lto_symtab_register_decl (tree decl,
ld_plugin_symbol_resolution_t resolution,
struct lto_file_decl_data *file_data)
{
symtab_node node;
/* Check that declarations reaching this function do not have
properties inconsistent with having external linkage. If any of
these asertions fail, then the object file reader has failed to
detect these cases and issue appropriate error messages. */
gcc_assert (decl
&& TREE_PUBLIC (decl)
&& (TREE_CODE (decl) == VAR_DECL
|| TREE_CODE (decl) == FUNCTION_DECL)
&& DECL_ASSEMBLER_NAME_SET_P (decl));
if (TREE_CODE (decl) == VAR_DECL
&& DECL_INITIAL (decl))
gcc_assert (!DECL_EXTERNAL (decl)
|| (TREE_STATIC (decl) && TREE_READONLY (decl)));
if (TREE_CODE (decl) == FUNCTION_DECL)
gcc_assert (!DECL_ABSTRACT (decl));
node = symtab_get_node (decl);
if (node)
{
node->symbol.resolution = resolution;
gcc_assert (node->symbol.lto_file_data == file_data);
}
}
/* Replace the cgraph node NODE with PREVAILING_NODE in the cgraph, merging
all edges and removing the old node. */
......
2012-10-06 Jan Hubicka <jh@suse.cz>
PR lto/54790
* lto.c (resolution_map): New static var.
(register_resolution): New function.
(lto_register_var_decl_in_symtab): Use it.
(read_cgraph_and_symbols): Copy resolutions into the symtab.
2012-09-20 Martin Jambor <mjambor@suse.cz>
* lto.c (lto_materialize_function): Call push_struct_function and
......
......@@ -1692,6 +1692,19 @@ get_resolution (struct data_in *data_in, unsigned index)
return LDPR_UNKNOWN;
}
/* Map assigning declarations their resolutions. */
static pointer_map_t *resolution_map;
/* We need to record resolutions until symbol table is read. */
static void
register_resolution (tree decl, enum ld_plugin_symbol_resolution resolution)
{
if (resolution == LDPR_UNKNOWN)
return;
if (!resolution_map)
resolution_map = pointer_map_create ();
*pointer_map_insert (resolution_map, decl) = (void *)(size_t)resolution;
}
/* Register DECL with the global symbol table and change its
name if necessary to avoid name clashes for static globals across
......@@ -1730,8 +1743,7 @@ lto_register_var_decl_in_symtab (struct data_in *data_in, tree decl)
unsigned ix;
if (!streamer_tree_cache_lookup (data_in->reader_cache, decl, &ix))
gcc_unreachable ();
lto_symtab_register_decl (decl, get_resolution (data_in, ix),
data_in->file_data);
register_resolution (decl, get_resolution (data_in, ix));
}
}
......@@ -1789,8 +1801,7 @@ lto_register_function_decl_in_symtab (struct data_in *data_in, tree decl)
unsigned ix;
if (!streamer_tree_cache_lookup (data_in->reader_cache, decl, &ix))
gcc_unreachable ();
lto_symtab_register_decl (decl, get_resolution (data_in, ix),
data_in->file_data);
register_resolution (decl, get_resolution (data_in, ix));
}
}
......@@ -2946,6 +2957,24 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
timevar_push (TV_IPA_LTO_CGRAPH_IO);
/* Read the symtab. */
input_symtab ();
/* Store resolutions into the symbol table. */
if (resolution_map)
{
void **res;
symtab_node snode;
FOR_EACH_SYMBOL (snode)
if (symtab_real_symbol_p (snode)
&& (res = pointer_map_contains (resolution_map,
snode->symbol.decl)))
snode->symbol.resolution
= (enum ld_plugin_symbol_resolution)(size_t)*res;
pointer_map_destroy (resolution_map);
resolution_map = NULL;
}
timevar_pop (TV_IPA_LTO_CGRAPH_IO);
if (!quiet_flag)
......
2012-10-06 Jan Hubicka <jh@suse.cz>
* gcc.dg/lto/resolutions_0.c: New testcase.
2012-10-06 Janus Weil <janus@gcc.gnu.org>
PR fortran/45521
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment