This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Free redirect_callers vector in tree-sra.c
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Martin Jambor <mjambor at suse dot de>
- Date: Thu, 16 Aug 2012 16:17:52 +0200 (CEST)
- Subject: [PATCH] Free redirect_callers vector in tree-sra.c
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));