aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2014-08-20 15:55:06 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2014-08-20 13:55:06 +0000
commit8605403e2bcb731d5f1c8579a9c2ea3436e2fb27 (patch)
treed02afd479c74875a28f01dba8b1c20718de3c062
parent3ba421e8becbd17526a88ec76226d7213b96af14 (diff)
downloadgcc-8605403e2bcb731d5f1c8579a9c2ea3436e2fb27.zip
gcc-8605403e2bcb731d5f1c8579a9c2ea3436e2fb27.tar.gz
gcc-8605403e2bcb731d5f1c8579a9c2ea3436e2fb27.tar.bz2
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
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/cgraphunit.c12
-rw-r--r--gcc/ipa-inline.c2
-rw-r--r--gcc/ipa.c7
-rw-r--r--gcc/lto/ChangeLog6
-rw-r--r--gcc/lto/lto.c9
-rw-r--r--gcc/passes.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/ipa/devirt-16.C1
-rw-r--r--gcc/testsuite/g++.dg/ipa/devirt-17.C1
10 files changed, 46 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0049763..2ce924f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,16 @@
+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>
PR c/59304
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 2c2006b..20294b3 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -2047,10 +2047,8 @@ 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. */
+ /* This extra symtab_remove_unreachable_nodes pass tends to catch some
+ devirtualization and other changes where removal iterate. */
symtab_remove_unreachable_nodes (true, cgraph_dump_file);
/* If pass_all_early_optimizations was not scheduled, the state of
@@ -2184,7 +2182,8 @@ compile (void)
}
/* 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);
cgraph_global_info_ready = true;
if (cgraph_dump_file)
@@ -2210,9 +2209,10 @@ compile (void)
cgraph_materialize_all_clones ();
bitmap_obstack_initialize (NULL);
execute_ipa_pass_list (g->get_passes ()->all_late_ipa_passes);
- symtab_remove_unreachable_nodes (true, dump_file);
#ifdef ENABLE_CHECKING
symtab_node::verify_symtab_nodes ();
+ /* Verify late IPA passes cleaned up after themselves. */
+ gcc_assert (!symtab_remove_unreachable_nodes (false, dump_file));
#endif
bitmap_obstack_release (NULL);
mark_functions_to_output ();
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 5f1c9b0..314262b 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -2519,7 +2519,7 @@ const pass_data pass_data_ipa_inline =
0, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
- TODO_remove_functions, /* todo_flags_start */
+ 0, /* todo_flags_start */
( TODO_dump_symtab ), /* todo_flags_finish */
};
diff --git a/gcc/ipa.c b/gcc/ipa.c
index 1081e89..bf6b2d7 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -727,14 +727,17 @@ namespace {
const pass_data pass_data_ipa_free_inline_summary =
{
SIMPLE_IPA_PASS, /* type */
- "*free_inline_summary", /* name */
+ "free-inline-summary", /* name */
OPTGROUP_NONE, /* optinfo_flags */
TV_IPA_FREE_INLINE_SUMMARY, /* tv_id */
0, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
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
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 2e3a156..f41992a 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,9 @@
+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>
* lto-symtab.c (lto_varpool_replace_node): Call compare_virtual_tables.
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index d211c80..f0e3261 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -3084,10 +3084,10 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
symtab_node::dump_table (cgraph_dump_file);
}
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 could also just remove them while merging. */
- symtab_remove_unreachable_nodes (false, dump_file);
+ symtab_remove_unreachable_nodes (true, dump_file);
ggc_collect ();
cgraph_state = CGRAPH_STATE_IPA_SSA;
@@ -3244,7 +3244,10 @@ do_whole_program_analysis (void)
cgraph_state = CGRAPH_STATE_IPA_SSA;
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)
{
diff --git a/gcc/passes.c b/gcc/passes.c
index dea9de1..7e47992 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -350,7 +350,9 @@ const pass_data pass_data_early_local_passes =
0, /* properties_provided */
0, /* properties_destroyed */
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
@@ -2119,7 +2121,7 @@ execute_one_pass (opt_pass *pass)
}
}
if (applied)
- symtab_remove_unreachable_nodes (true, dump_file);
+ symtab_remove_unreachable_nodes (false, dump_file);
/* Restore current_pass. */
current_pass = pass;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 73390a2..de08c9a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+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>
PR c/59304
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-16.C b/gcc/testsuite/g++.dg/ipa/devirt-16.C
index dd7696e..99a1ea6 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-16.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-16.C
@@ -32,7 +32,6 @@ main()
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-not "A::foo" "whole-program"} } */
/* { dg-final { scan-ipa-dump-not "A::foo" "whole-program"} } */
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-17.C b/gcc/testsuite/g++.dg/ipa/devirt-17.C
index ce7943a..df10c48 100644
--- a/gcc/testsuite/g++.dg/ipa/devirt-17.C
+++ b/gcc/testsuite/g++.dg/ipa/devirt-17.C
@@ -37,7 +37,6 @@ main()
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 "B::foo" "whole-program"} } */
/* { dg-final { scan-ipa-dump-not "A::foo" "whole-program"} } */