This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [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 17:21:58 +0200 (CEST)
- Subject: Re: [PATCH] Free redirect_callers vector in tree-sra.c
- References: <alpine.LNX.2.00.1208161615080.28649@zhemvz.fhfr.qr>
On Thu, 16 Aug 2012, Richard Guenther wrote:
>
> 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.
The re-ordering fails gcc.dg/ipa/ipa-sra-6.c, I'll re-do without that.
Richard.
> 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));
>
>
--
Richard Guenther <rguenther@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend