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
This commit is contained in:
Jan Hubicka 2011-10-02 16:30:50 +02:00 committed by Jan Hubicka
parent 78e5ce9f1e
commit 467a8db025
7 changed files with 32 additions and 9 deletions

View File

@ -1,3 +1,11 @@
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.

View File

@ -2011,6 +2011,12 @@ ipa_passes (void)
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
the cgraph will not be properly updated. Update it now. */
if (cgraph_state < CGRAPH_STATE_IPA_SSA)

View File

@ -196,12 +196,7 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
/* Keep around virtual functions for possible devirtualization. */
|| (before_inlining_p
&& DECL_VIRTUAL_P (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)))
&& (DECL_COMDAT (node->decl) || DECL_EXTERNAL (node->decl)))))
{
gcc_assert (!node->global.inlined_to);
enqueue_cgraph_node (node, &first);

View File

@ -1407,6 +1407,15 @@ produce_symtab (struct output_block *ob,
node = lto_cgraph_encoder_deref (encoder, i);
if (!DECL_EXTERNAL (node->decl))
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)
&& cgraph_comdat_can_be_unshared_p (node))
continue;

View File

@ -1,3 +1,7 @@
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>
* gcc.target/sparc/cmask.c: New test.

View File

@ -1,8 +1,8 @@
/* { dg-do compile } */
/* { dg-options "-O3 -c -fdump-ipa-whole-program" } */
/* { dg-options "-O3 -c -fdump-ipa-cgraph" } */
static __attribute__((constructor))
void empty_constructor()
{
}
/* { dg-final { scan-ipa-dump "Reclaiming functions: empty_constructor" "whole-program" } } */
/* { dg-final { cleanup-ipa-dump "whole-program" } } */
/* { dg-final { scan-ipa-dump "Reclaiming functions: empty_constructor" "cgraph" } } */
/* { dg-final { cleanup-ipa-dump "cgraph" } } */

View File

@ -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);
rebuild_cgraph_edges ();
free_dominance_info (CDI_DOMINATORS);
pop_cfun ();
current_function_decl = NULL_TREE;