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
This commit is contained in:
David Malcolm 2014-12-04 21:11:04 +00:00 committed by David Malcolm
parent ef9f382ca5
commit 953971cf7d
4 changed files with 28 additions and 2 deletions

View file

@ -1,3 +1,15 @@
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

View file

@ -3613,7 +3613,8 @@ ipa_register_cgraph_hooks (void)
if (!node_duplication_hook_holder)
node_duplication_hook_holder =
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);
}

View file

@ -1198,4 +1198,15 @@ ipa_reference_c_finalize (void)
bitmap_obstack_release (&optimization_summary_obstack);
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;
}
}

View file

@ -2163,12 +2163,14 @@ toplev::finalize (void)
rtl_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 ();
cgraphunit_c_finalize ();
dwarf2out_c_finalize ();
gcse_c_finalize ();
ipa_cp_c_finalize ();
ipa_reference_c_finalize ();
ira_costs_c_finalize ();
params_c_finalize ();