Commit 467a8db0 by Jan Hubicka Committed by Jan Hubicka

cgraphunit.c (ipa_passes): Remove unrechable nodes.


	* cgraphunit.c (ipa_passes): Remove unrechable nodes.
	* lto-streamer-out.c (produce_symtab): Skip unused extern declarations.
	* ipa.c (cgraph_remove_unreachable_nodes): Do not assume that external
	functions are reachable when address is taken.
	* ipa-inline-analysis.c (reset_inline_edge_summary): New

	* gcc.dg/ipa/ctor-empty-1.c: Update dump file.

From-SVN: r179429
parent 78e5ce9f
2011-10-02 Jan Hubicka <jh@suse.cz> 2011-10-02 Jan Hubicka <jh@suse.cz>
* cgraphunit.c (ipa_passes): Remove unrechable nodes.
* lto-streamer-out.c (produce_symtab): Skip unused extern declarations.
* ipa.c (cgraph_remove_unreachable_nodes): Do not assume that external
functions are reachable when address is taken.
* tree-sra.c (modify_function): Free dominance info.
2011-10-02 Jan Hubicka <jh@suse.cz>
* ipa-inline-analysis.c (inline_summary_alloc): Bounds check. * ipa-inline-analysis.c (inline_summary_alloc): Bounds check.
* ipa-inline-analysis.c (reset_inline_edge_summary): New function. * ipa-inline-analysis.c (reset_inline_edge_summary): New function.
...@@ -2011,6 +2011,12 @@ ipa_passes (void) ...@@ -2011,6 +2011,12 @@ ipa_passes (void)
return; return;
} }
/* We never run removal of unreachable nodes after early passes. This is
because TODO is run before the subpasses. It is important to remove
the unreachable functions to save works at IPA level and to get LTO
symbol tables right. */
cgraph_remove_unreachable_nodes (true, cgraph_dump_file);
/* If pass_all_early_optimizations was not scheduled, the state of /* If pass_all_early_optimizations was not scheduled, the state of
the cgraph will not be properly updated. Update it now. */ the cgraph will not be properly updated. Update it now. */
if (cgraph_state < CGRAPH_STATE_IPA_SSA) if (cgraph_state < CGRAPH_STATE_IPA_SSA)
......
...@@ -196,12 +196,7 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file) ...@@ -196,12 +196,7 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
/* Keep around virtual functions for possible devirtualization. */ /* Keep around virtual functions for possible devirtualization. */
|| (before_inlining_p || (before_inlining_p
&& DECL_VIRTUAL_P (node->decl) && DECL_VIRTUAL_P (node->decl)
&& (DECL_COMDAT (node->decl) || DECL_EXTERNAL (node->decl))) && (DECL_COMDAT (node->decl) || DECL_EXTERNAL (node->decl)))))
/* Also external functions with address taken are better to stay
for indirect inlining. */
|| (before_inlining_p
&& DECL_EXTERNAL (node->decl)
&& node->address_taken)))
{ {
gcc_assert (!node->global.inlined_to); gcc_assert (!node->global.inlined_to);
enqueue_cgraph_node (node, &first); enqueue_cgraph_node (node, &first);
......
...@@ -1407,6 +1407,15 @@ produce_symtab (struct output_block *ob, ...@@ -1407,6 +1407,15 @@ produce_symtab (struct output_block *ob,
node = lto_cgraph_encoder_deref (encoder, i); node = lto_cgraph_encoder_deref (encoder, i);
if (!DECL_EXTERNAL (node->decl)) if (!DECL_EXTERNAL (node->decl))
continue; continue;
/* We keep around unused extern inlines in order to be able to inline
them indirectly or via vtables. Do not output them to symbol
table: they end up being undefined and just consume space. */
if (!node->address_taken && !node->callers)
{
gcc_assert (node->analyzed);
gcc_assert (DECL_DECLARED_INLINE_P (node->decl));
continue;
}
if (DECL_COMDAT (node->decl) if (DECL_COMDAT (node->decl)
&& cgraph_comdat_can_be_unshared_p (node)) && cgraph_comdat_can_be_unshared_p (node))
continue; continue;
......
2011-10-02 Jan Hubicka <jh@suse.cz>
* gcc.dg/ipa/ctor-empty-1.c: Update dump file.
2011-10-01 David S. Miller <davem@davemloft.net> 2011-10-01 David S. Miller <davem@davemloft.net>
* gcc.target/sparc/cmask.c: New test. * gcc.target/sparc/cmask.c: New test.
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O3 -c -fdump-ipa-whole-program" } */ /* { dg-options "-O3 -c -fdump-ipa-cgraph" } */
static __attribute__((constructor)) static __attribute__((constructor))
void empty_constructor() void empty_constructor()
{ {
} }
/* { dg-final { scan-ipa-dump "Reclaiming functions: empty_constructor" "whole-program" } } */ /* { dg-final { scan-ipa-dump "Reclaiming functions: empty_constructor" "cgraph" } } */
/* { dg-final { cleanup-ipa-dump "whole-program" } } */ /* { dg-final { cleanup-ipa-dump "cgraph" } } */
...@@ -4622,6 +4622,7 @@ modify_function (struct cgraph_node *node, ipa_parm_adjustment_vec adjustments) ...@@ -4622,6 +4622,7 @@ modify_function (struct cgraph_node *node, ipa_parm_adjustment_vec adjustments)
VEC (cgraph_edge_p, heap) * redirect_callers = collect_callers_of_node (node); VEC (cgraph_edge_p, heap) * redirect_callers = collect_callers_of_node (node);
rebuild_cgraph_edges (); rebuild_cgraph_edges ();
free_dominance_info (CDI_DOMINATORS);
pop_cfun (); pop_cfun ();
current_function_decl = NULL_TREE; current_function_decl = NULL_TREE;
......
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