diff options
author | Jan Hubicka <jh@suse.cz> | 2020-09-22 22:16:00 +0200 |
---|---|---|
committer | Jan Hubicka <jh@suse.cz> | 2020-09-22 22:16:00 +0200 |
commit | 39b3b1bdd9ea3d36ce41276b8452506b79cc4368 (patch) | |
tree | 73312eeeb748fae914dff5f43aca2a842270b25a | |
parent | 7d8177b027b87cf3211e2d6cf144ec71616425ea (diff) | |
download | gcc-39b3b1bdd9ea3d36ce41276b8452506b79cc4368.zip gcc-39b3b1bdd9ea3d36ce41276b8452506b79cc4368.tar.gz gcc-39b3b1bdd9ea3d36ce41276b8452506b79cc4368.tar.bz2 |
Fix ipa-modref selftest and destructor
* ipa-modref-tree.c: Add namespace selftest.
(modref_tree_c_tests): Rename to ...
(ipa_modref_tree_c_tests): ... this.
* ipa-modref.c (pass_modref): Remove destructor.
(ipa_modref_c_finalize): New function.
* ipa-modref.h (ipa_modref_c_finalize): Declare.
* selftest-run-tests.c (selftest::run_tests): Call
ipa_modref_c_finalize.
* selftest.h (ipa_modref_tree_c_tests): Declare.
* toplev.c: Include ipa-modref-tree.h and ipa-modref.h
(toplev::finalize): Call ipa_modref_c_finalize.
-rw-r--r-- | gcc/ipa-modref-tree.c | 5 | ||||
-rw-r--r-- | gcc/ipa-modref.c | 16 | ||||
-rw-r--r-- | gcc/ipa-modref.h | 1 | ||||
-rw-r--r-- | gcc/selftest-run-tests.c | 1 | ||||
-rw-r--r-- | gcc/selftest.h | 1 | ||||
-rw-r--r-- | gcc/toplev.c | 3 |
6 files changed, 20 insertions, 7 deletions
diff --git a/gcc/ipa-modref-tree.c b/gcc/ipa-modref-tree.c index e37dee6..a84508a 100644 --- a/gcc/ipa-modref-tree.c +++ b/gcc/ipa-modref-tree.c @@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see #if CHECKING_P +namespace selftest { static void test_insert_search_collapse () @@ -156,12 +157,14 @@ test_merge () void -modref_tree_c_tests () +ipa_modref_tree_c_tests () { test_insert_search_collapse (); test_merge (); } +} // namespace selftest + #endif void diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c index 0411f66..d195354 100644 --- a/gcc/ipa-modref.c +++ b/gcc/ipa-modref.c @@ -767,12 +767,6 @@ class pass_modref : public gimple_opt_pass pass_modref (gcc::context *ctxt) : gimple_opt_pass (pass_data_modref, ctxt) {} - ~pass_modref () - { - ggc_delete (summaries); - summaries = NULL; - } - /* opt_pass methods: */ opt_pass *clone () { @@ -1373,4 +1367,14 @@ unsigned int pass_ipa_modref::execute (function *) return 0; } +/* Summaries must stay alive until end of compilation. */ + +void +ipa_modref_c_finalize () +{ + if (summaries) + ggc_delete (summaries); + summaries = NULL; +} + #include "gt-ipa-modref.h" diff --git a/gcc/ipa-modref.h b/gcc/ipa-modref.h index 6f97920..6cccdfe 100644 --- a/gcc/ipa-modref.h +++ b/gcc/ipa-modref.h @@ -44,5 +44,6 @@ struct GTY(()) modref_summary }; modref_summary *get_modref_function_summary (cgraph_node *func); +void ipa_modref_c_finalize (); #endif diff --git a/gcc/selftest-run-tests.c b/gcc/selftest-run-tests.c index f0a81d4..7a89b2d 100644 --- a/gcc/selftest-run-tests.c +++ b/gcc/selftest-run-tests.c @@ -90,6 +90,7 @@ selftest::run_tests () read_rtl_function_c_tests (); digraph_cc_tests (); tristate_cc_tests (); + ipa_modref_tree_c_tests (); /* Higher-level tests, or for components that other selftests don't rely on. */ diff --git a/gcc/selftest.h b/gcc/selftest.h index 5cffa13..6c6c7f2 100644 --- a/gcc/selftest.h +++ b/gcc/selftest.h @@ -268,6 +268,7 @@ extern void vec_perm_indices_c_tests (); extern void wide_int_cc_tests (); extern void opt_proposer_c_tests (); extern void dbgcnt_c_tests (); +extern void ipa_modref_tree_c_tests (); extern int num_passes; diff --git a/gcc/toplev.c b/gcc/toplev.c index cdd4b5b..a4cb8bb 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -84,6 +84,8 @@ along with GCC; see the file COPYING3. If not see #include "dump-context.h" #include "print-tree.h" #include "optinfo-emit-json.h" +#include "ipa-modref-tree.h" +#include "ipa-modref.h" #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO) #include "dbxout.h" @@ -2497,6 +2499,7 @@ toplev::finalize (void) /* Needs to be called before cgraph_c_finalize since it uses symtab. */ ipa_reference_c_finalize (); ipa_fnsummary_c_finalize (); + ipa_modref_c_finalize (); cgraph_c_finalize (); cgraphunit_c_finalize (); |