Commit 953971cf by David Malcolm Committed by David Malcolm

PR jit/63854: Fix leak of ipa hooks

gcc/ChangeLog:
	PR jit/63854
	* ipa-prop.c (ipa_register_cgraph_hooks): Guard insertion of
	ipa_add_new_function on function_insertion_hook_holder being
	non-NULL.
	* ipa-reference.c (ipa_reference_c_finalize): Remove
	node_removal_hook_holder and node_duplication_hook_holder if
	they've been added to symtab.
	* toplev.c (toplev::finalize): Call ipa_reference_c_finalize
	before cgraph_c_finalize so that the former can access "symtab".

From-SVN: r218403
parent ef9f382c
2014-12-04 David Malcolm <dmalcolm@redhat.com> 2014-12-04 David Malcolm <dmalcolm@redhat.com>
PR jit/63854
* ipa-prop.c (ipa_register_cgraph_hooks): Guard insertion of
ipa_add_new_function on function_insertion_hook_holder being
non-NULL.
* ipa-reference.c (ipa_reference_c_finalize): Remove
node_removal_hook_holder and node_duplication_hook_holder if
they've been added to symtab.
* toplev.c (toplev::finalize): Call ipa_reference_c_finalize
before cgraph_c_finalize so that the former can access "symtab".
2014-12-04 David Malcolm <dmalcolm@redhat.com>
* doc/cfg.texi (GIMPLE statement iterators): Add note about * doc/cfg.texi (GIMPLE statement iterators): Add note about
gphi_iterator, and use one in the example. gphi_iterator, and use one in the example.
* doc/gimple.texi (Tuple specific accessors): Add missing * doc/gimple.texi (Tuple specific accessors): Add missing
...@@ -3613,7 +3613,8 @@ ipa_register_cgraph_hooks (void) ...@@ -3613,7 +3613,8 @@ ipa_register_cgraph_hooks (void)
if (!node_duplication_hook_holder) if (!node_duplication_hook_holder)
node_duplication_hook_holder = node_duplication_hook_holder =
symtab->add_cgraph_duplication_hook (&ipa_node_duplication_hook, NULL); symtab->add_cgraph_duplication_hook (&ipa_node_duplication_hook, NULL);
function_insertion_hook_holder = if (!function_insertion_hook_holder)
function_insertion_hook_holder =
symtab->add_cgraph_insertion_hook (&ipa_add_new_function, NULL); symtab->add_cgraph_insertion_hook (&ipa_add_new_function, NULL);
} }
......
...@@ -1198,4 +1198,15 @@ ipa_reference_c_finalize (void) ...@@ -1198,4 +1198,15 @@ ipa_reference_c_finalize (void)
bitmap_obstack_release (&optimization_summary_obstack); bitmap_obstack_release (&optimization_summary_obstack);
ipa_init_p = false; ipa_init_p = false;
} }
if (node_removal_hook_holder)
{
symtab->remove_cgraph_removal_hook (node_removal_hook_holder);
node_removal_hook_holder = NULL;
}
if (node_duplication_hook_holder)
{
symtab->remove_cgraph_duplication_hook (node_duplication_hook_holder);
node_duplication_hook_holder = NULL;
}
} }
...@@ -2163,12 +2163,14 @@ toplev::finalize (void) ...@@ -2163,12 +2163,14 @@ toplev::finalize (void)
rtl_initialized = false; rtl_initialized = false;
this_target_rtl->target_specific_initialized = false; this_target_rtl->target_specific_initialized = false;
/* Needs to be called before cgraph_c_finalize since it uses symtab. */
ipa_reference_c_finalize ();
cgraph_c_finalize (); cgraph_c_finalize ();
cgraphunit_c_finalize (); cgraphunit_c_finalize ();
dwarf2out_c_finalize (); dwarf2out_c_finalize ();
gcse_c_finalize (); gcse_c_finalize ();
ipa_cp_c_finalize (); ipa_cp_c_finalize ();
ipa_reference_c_finalize ();
ira_costs_c_finalize (); ira_costs_c_finalize ();
params_c_finalize (); params_c_finalize ();
......
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