This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix a slp leak caused by vec.h conversion (PR middle-end/56461)
- From: Diego Novillo <dnovillo at google dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Richard Biener <rguenther at suse dot de>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 28 Feb 2013 16:16:39 -0500
- Subject: Re: [PATCH] Fix a slp leak caused by vec.h conversion (PR middle-end/56461)
- References: <20130228200612.GX12913@tucnak.redhat.com>
On Thu, Feb 28, 2013 at 3:06 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> This is small, but quite common memory leak in slp vectorization.
> vec_alloc (vec_defs, number_of_vects);
> on vl_ptr-ish vec<tree> *vec_defs; first calls new on the vec<tree>
> (i.e. allocates sizeof (void *) bytes), and then actually creates vector
> pointed to by that. Later on we copy the content of what it points to,
> but don't actually free the void * sized allocation.
> Fixed by changing the vector to be actually vec<vec<tree> > *, which also
> simplifies the callers.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2013-02-28 Jakub Jelinek <jakub@redhat.com>
>
> PR middle-end/56461
> * tree-vectorizer.h (vect_get_slp_defs): Change 3rd argument
> type to vec<vec<tree> > *.
> * tree-vect-slp.c (vect_get_slp_defs): Likewise. Change vec_defs
> to be vec<tree> instead of vec<tree> *, set vec_defs
> to vNULL and call vec_defs.create (number_of_vects), adjust other
> uses of vec_defs.
> * tree-vect-stmts.c (vect_get_vec_defs, vectorizable_call,
> vectorizable_condition): Adjust vect_get_slp_defs callers.
OK.
Diego.