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.
This commit is contained in:
Jan Hubicka 2020-09-22 22:16:00 +02:00
parent 7d8177b027
commit 39b3b1bdd9
6 changed files with 20 additions and 7 deletions

View File

@ -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

View File

@ -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"

View File

@ -44,5 +44,6 @@ struct GTY(()) modref_summary
};
modref_summary *get_modref_function_summary (cgraph_node *func);
void ipa_modref_c_finalize ();
#endif

View File

@ -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. */

View File

@ -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;

View File

@ -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 ();