[PATCH] Free redirect_callers vector in tree-sra.c
Richard Guenther
rguenther@suse.de
Thu Aug 16 14:20:00 GMT 2012
I noticed we leak the redirect_callers vector in SRA and also noticed
we compute it and then immediately re-compute cgraph edges which
looks weird to me.
Thus the following patch which frees the vector and makes its lifetime
more obvious.
Queued for testing.
Richard.
2012-08-16 Richard Guenther <rguenther@suse.de>
* tree-sra.c (modify_function): Collect callers after rebuilding
cgraph edges. Free caller vector.
Index: gcc/tree-sra.c
===================================================================
--- gcc/tree-sra.c (revision 190442)
+++ gcc/tree-sra.c (working copy)
@@ -4689,15 +4689,18 @@ modify_function (struct cgraph_node *nod
{
struct cgraph_node *new_node;
bool cfg_changed;
- VEC (cgraph_edge_p, heap) * redirect_callers = collect_callers_of_node (node);
+ VEC (cgraph_edge_p, heap) * redirect_callers;
rebuild_cgraph_edges ();
free_dominance_info (CDI_DOMINATORS);
pop_cfun ();
current_function_decl = NULL_TREE;
+ redirect_callers = collect_callers_of_node (node);
new_node = cgraph_function_versioning (node, redirect_callers, NULL, NULL,
false, NULL, NULL, "isra");
+ VEC_free (cgraph_edge_p, heap, redirect_callers);
+
current_function_decl = new_node->symbol.decl;
push_cfun (DECL_STRUCT_FUNCTION (new_node->symbol.decl));
More information about the Gcc-patches
mailing list