Commit 8605403e by Jan Hubicka Committed by Jan Hubicka

cgraphunit.c (ipa_passes, compile): Reshedule symtab_remove_unreachable_nodes…

cgraphunit.c (ipa_passes, compile): Reshedule symtab_remove_unreachable_nodes passes; update comments.

	* cgraphunit.c (ipa_passes, compile): Reshedule
	symtab_remove_unreachable_nodes passes; update comments.
	* ipa-inline.c (pass_data_ipa_inline): Do not schedule
	TODO_remove_functions before the pass; the functions ought to be
	already removed.
	* ipa.c (pass_data_ipa_free_inline_summary): Enable dump; schedule
	TODO_remove_functions.
	* passes.c (pass_data_early_local_passes): Do not schedule function
	removal.
	(execute_one_pass): Fix call of symtab_remove_unreachable_nodes.

	* lto.c (read_cgraph_and_symbols): Fix symtab_remove_unreachable_nodes
	call.
	(do_whole_program_analysis): Only sanity check that IPA passes cleans up.

	* testsuite/g++.dg/ipa/devirt-17.C: Update template.
	* testsuite/g++.dg/ipa/devirt-16.C: Update template.

From-SVN: r214224
parent 3ba421e8
2014-08-20 Jan Hubicka <hubicka@ucw.cz>
* cgraphunit.c (ipa_passes, compile): Reshedule
symtab_remove_unreachable_nodes passes; update comments.
* ipa-inline.c (pass_data_ipa_inline): Do not schedule
TODO_remove_functions before the pass; the functions ought to be
already removed.
* ipa.c (pass_data_ipa_free_inline_summary): Enable dump; schedule
TODO_remove_functions.
* passes.c (pass_data_early_local_passes): Do not schedule function
removal.
(execute_one_pass): Fix call of symtab_remove_unreachable_nodes.
2014-08-20 Manuel López-Ibáñez <manu@gcc.gnu.org> 2014-08-20 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c/59304 PR c/59304
......
...@@ -2047,10 +2047,8 @@ ipa_passes (void) ...@@ -2047,10 +2047,8 @@ ipa_passes (void)
return; return;
} }
/* We never run removal of unreachable nodes after early passes. This is /* This extra symtab_remove_unreachable_nodes pass tends to catch some
because TODO is run before the subpasses. It is important to remove devirtualization and other changes where removal iterate. */
the unreachable functions to save works at IPA level and to get LTO
symbol tables right. */
symtab_remove_unreachable_nodes (true, cgraph_dump_file); symtab_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
...@@ -2184,7 +2182,8 @@ compile (void) ...@@ -2184,7 +2182,8 @@ compile (void)
} }
/* This pass remove bodies of extern inline functions we never inlined. /* This pass remove bodies of extern inline functions we never inlined.
Do this later so other IPA passes see what is really going on. */ Do this later so other IPA passes see what is really going on.
FIXME: This should be run just after inlining by pasmanager. */
symtab_remove_unreachable_nodes (false, dump_file); symtab_remove_unreachable_nodes (false, dump_file);
cgraph_global_info_ready = true; cgraph_global_info_ready = true;
if (cgraph_dump_file) if (cgraph_dump_file)
...@@ -2210,9 +2209,10 @@ compile (void) ...@@ -2210,9 +2209,10 @@ compile (void)
cgraph_materialize_all_clones (); cgraph_materialize_all_clones ();
bitmap_obstack_initialize (NULL); bitmap_obstack_initialize (NULL);
execute_ipa_pass_list (g->get_passes ()->all_late_ipa_passes); execute_ipa_pass_list (g->get_passes ()->all_late_ipa_passes);
symtab_remove_unreachable_nodes (true, dump_file);
#ifdef ENABLE_CHECKING #ifdef ENABLE_CHECKING
symtab_node::verify_symtab_nodes (); symtab_node::verify_symtab_nodes ();
/* Verify late IPA passes cleaned up after themselves. */
gcc_assert (!symtab_remove_unreachable_nodes (false, dump_file));
#endif #endif
bitmap_obstack_release (NULL); bitmap_obstack_release (NULL);
mark_functions_to_output (); mark_functions_to_output ();
......
...@@ -2519,7 +2519,7 @@ const pass_data pass_data_ipa_inline = ...@@ -2519,7 +2519,7 @@ const pass_data pass_data_ipa_inline =
0, /* properties_required */ 0, /* properties_required */
0, /* properties_provided */ 0, /* properties_provided */
0, /* properties_destroyed */ 0, /* properties_destroyed */
TODO_remove_functions, /* todo_flags_start */ 0, /* todo_flags_start */
( TODO_dump_symtab ), /* todo_flags_finish */ ( TODO_dump_symtab ), /* todo_flags_finish */
}; };
......
...@@ -727,14 +727,17 @@ namespace { ...@@ -727,14 +727,17 @@ namespace {
const pass_data pass_data_ipa_free_inline_summary = const pass_data pass_data_ipa_free_inline_summary =
{ {
SIMPLE_IPA_PASS, /* type */ SIMPLE_IPA_PASS, /* type */
"*free_inline_summary", /* name */ "free-inline-summary", /* name */
OPTGROUP_NONE, /* optinfo_flags */ OPTGROUP_NONE, /* optinfo_flags */
TV_IPA_FREE_INLINE_SUMMARY, /* tv_id */ TV_IPA_FREE_INLINE_SUMMARY, /* tv_id */
0, /* properties_required */ 0, /* properties_required */
0, /* properties_provided */ 0, /* properties_provided */
0, /* properties_destroyed */ 0, /* properties_destroyed */
0, /* todo_flags_start */ 0, /* todo_flags_start */
0, /* todo_flags_finish */ /* Early optimizations may make function unreachable. We can not
remove unreachable functions as part of the ealry opts pass because
TODOs are run before subpasses. Do it here. */
( TODO_remove_functions | TODO_dump_symtab ), /* todo_flags_finish */
}; };
class pass_ipa_free_inline_summary : public simple_ipa_opt_pass class pass_ipa_free_inline_summary : public simple_ipa_opt_pass
......
2014-08-20 Jan Hubicka <hubicka@ucw.cz>
* lto.c (read_cgraph_and_symbols): Fix symtab_remove_unreachable_nodes
call.
(do_whole_program_analysis): Only sanity check that IPA passes cleans up.
2014-08-14 Jan Hubicka <hubicka@ucw.cz> 2014-08-14 Jan Hubicka <hubicka@ucw.cz>
* lto-symtab.c (lto_varpool_replace_node): Call compare_virtual_tables. * lto-symtab.c (lto_varpool_replace_node): Call compare_virtual_tables.
......
...@@ -3084,10 +3084,10 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) ...@@ -3084,10 +3084,10 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
symtab_node::dump_table (cgraph_dump_file); symtab_node::dump_table (cgraph_dump_file);
} }
lto_symtab_merge_symbols (); lto_symtab_merge_symbols ();
/* Removal of unreacable symbols is needed to make verify_symtab to pass; /* Removal of unreachable symbols is needed to make verify_symtab to pass;
we are still having duplicated comdat groups containing local statics. we are still having duplicated comdat groups containing local statics.
We could also just remove them while merging. */ We could also just remove them while merging. */
symtab_remove_unreachable_nodes (false, dump_file); symtab_remove_unreachable_nodes (true, dump_file);
ggc_collect (); ggc_collect ();
cgraph_state = CGRAPH_STATE_IPA_SSA; cgraph_state = CGRAPH_STATE_IPA_SSA;
...@@ -3244,7 +3244,10 @@ do_whole_program_analysis (void) ...@@ -3244,7 +3244,10 @@ do_whole_program_analysis (void)
cgraph_state = CGRAPH_STATE_IPA_SSA; cgraph_state = CGRAPH_STATE_IPA_SSA;
execute_ipa_pass_list (g->get_passes ()->all_regular_ipa_passes); execute_ipa_pass_list (g->get_passes ()->all_regular_ipa_passes);
symtab_remove_unreachable_nodes (false, dump_file); #ifdef ENABLE_CHECKING
/* Verify that IPA passes cleans up after themselves. */
gcc_assert (!symtab_remove_unreachable_nodes (false, dump_file));
#endif
if (cgraph_dump_file) if (cgraph_dump_file)
{ {
......
...@@ -350,7 +350,9 @@ const pass_data pass_data_early_local_passes = ...@@ -350,7 +350,9 @@ const pass_data pass_data_early_local_passes =
0, /* properties_provided */ 0, /* properties_provided */
0, /* properties_destroyed */ 0, /* properties_destroyed */
0, /* todo_flags_start */ 0, /* todo_flags_start */
TODO_remove_functions, /* todo_flags_finish */ /* todo_flags_finish is executed before subpases. For this reason
it makes no sense to remove unreachable functions here. */
0, /* todo_flags_finish */
}; };
class pass_early_local_passes : public simple_ipa_opt_pass class pass_early_local_passes : public simple_ipa_opt_pass
...@@ -2119,7 +2121,7 @@ execute_one_pass (opt_pass *pass) ...@@ -2119,7 +2121,7 @@ execute_one_pass (opt_pass *pass)
} }
} }
if (applied) if (applied)
symtab_remove_unreachable_nodes (true, dump_file); symtab_remove_unreachable_nodes (false, dump_file);
/* Restore current_pass. */ /* Restore current_pass. */
current_pass = pass; current_pass = pass;
} }
......
2014-08-20 Jan Hubicka <hubicka@ucw.cz>
* testsuite/g++.dg/ipa/devirt-17.C: Update template.
* testsuite/g++.dg/ipa/devirt-16.C: Update template.
2014-08-20 Manuel López-Ibáñez <manu@gcc.gnu.org> 2014-08-20 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c/59304 PR c/59304
......
...@@ -32,7 +32,6 @@ main() ...@@ -32,7 +32,6 @@ main()
return b->foo(); return b->foo();
} }
/* { dg-final { scan-ipa-dump "devirtualizing" "whole-program"} } */
/* { dg-final { scan-ipa-dump "builtin_unreachable" "whole-program"} } */ /* { dg-final { scan-ipa-dump "builtin_unreachable" "whole-program"} } */
/* { dg-final { scan-ipa-dump-not "A::foo" "whole-program"} } */ /* { dg-final { scan-ipa-dump-not "A::foo" "whole-program"} } */
/* { dg-final { scan-ipa-dump-not "A::foo" "whole-program"} } */ /* { dg-final { scan-ipa-dump-not "A::foo" "whole-program"} } */
......
...@@ -37,7 +37,6 @@ main() ...@@ -37,7 +37,6 @@ main()
return b->foo(); return b->foo();
} }
/* { dg-final { scan-ipa-dump "devirtualizing" "whole-program"} } */
/* { dg-final { scan-ipa-dump-not "builtin_unreachable" "whole-program"} } */ /* { dg-final { scan-ipa-dump-not "builtin_unreachable" "whole-program"} } */
/* { dg-final { scan-ipa-dump "B::foo" "whole-program"} } */ /* { dg-final { scan-ipa-dump "B::foo" "whole-program"} } */
/* { dg-final { scan-ipa-dump-not "A::foo" "whole-program"} } */ /* { dg-final { scan-ipa-dump-not "A::foo" "whole-program"} } */
......
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