* [PATCH] Fix vect_create_epilog_for_reduction memory leaks (PR middle-end/56461)
@ 2013-03-04 21:03 Jakub Jelinek
2013-03-05 9:06 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2013-03-04 21:03 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches
Hi!
vect_create_epilog_for_reduction leaks memory both from the inner_phis
vector not being released for double_reduc, and also for stmt_vec_info
it creates (because those are added for stmts added into exit_bb, i.e.
after loop, which destroy_loop_vec_info doesn't free). Fixed thusly,
bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2013-03-04 Jakub Jelinek <jakub@redhat.com>
PR middle-end/56461
* tree-vect-stmts.c (free_stmt_vec_info_vec): Call
free_stmt_vec_info on any left-over stmt_vec_info in the vector.
* tree-vect-loop.c (vect_create_epilog_for_reduction): Release
inner_phis vector.
--- gcc/tree-vect-stmts.c.jj 2013-03-04 11:07:33.000000000 +0100
+++ gcc/tree-vect-stmts.c 2013-03-04 12:14:16.111393716 +0100
@@ -5969,6 +5969,11 @@ init_stmt_vec_info_vec (void)
void
free_stmt_vec_info_vec (void)
{
+ unsigned int i;
+ vec_void_p info;
+ FOR_EACH_VEC_ELT (stmt_vec_info_vec, i, info)
+ if (info != NULL)
+ free_stmt_vec_info (STMT_VINFO_STMT ((stmt_vec_info) info));
gcc_assert (stmt_vec_info_vec.exists ());
stmt_vec_info_vec.release ();
}
--- gcc/tree-vect-loop.c.jj 2013-03-04 11:01:48.000000000 +0100
+++ gcc/tree-vect-loop.c 2013-03-04 12:17:09.934351015 +0100
@@ -4487,8 +4487,9 @@ vect_finalize_reduction:
}
scalar_results.release ();
+ inner_phis.release ();
new_phis.release ();
-}
+}
/* Function vectorizable_reduction.
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix vect_create_epilog_for_reduction memory leaks (PR middle-end/56461)
2013-03-04 21:03 [PATCH] Fix vect_create_epilog_for_reduction memory leaks (PR middle-end/56461) Jakub Jelinek
@ 2013-03-05 9:06 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2013-03-05 9:06 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gcc-patches
On Mon, 4 Mar 2013, Jakub Jelinek wrote:
> Hi!
>
> vect_create_epilog_for_reduction leaks memory both from the inner_phis
> vector not being released for double_reduc, and also for stmt_vec_info
> it creates (because those are added for stmts added into exit_bb, i.e.
> after loop, which destroy_loop_vec_info doesn't free). Fixed thusly,
> bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
Ok.
Thanks,
Richard.
> 2013-03-04 Jakub Jelinek <jakub@redhat.com>
>
> PR middle-end/56461
> * tree-vect-stmts.c (free_stmt_vec_info_vec): Call
> free_stmt_vec_info on any left-over stmt_vec_info in the vector.
> * tree-vect-loop.c (vect_create_epilog_for_reduction): Release
> inner_phis vector.
>
> --- gcc/tree-vect-stmts.c.jj 2013-03-04 11:07:33.000000000 +0100
> +++ gcc/tree-vect-stmts.c 2013-03-04 12:14:16.111393716 +0100
> @@ -5969,6 +5969,11 @@ init_stmt_vec_info_vec (void)
> void
> free_stmt_vec_info_vec (void)
> {
> + unsigned int i;
> + vec_void_p info;
> + FOR_EACH_VEC_ELT (stmt_vec_info_vec, i, info)
> + if (info != NULL)
> + free_stmt_vec_info (STMT_VINFO_STMT ((stmt_vec_info) info));
> gcc_assert (stmt_vec_info_vec.exists ());
> stmt_vec_info_vec.release ();
> }
> --- gcc/tree-vect-loop.c.jj 2013-03-04 11:01:48.000000000 +0100
> +++ gcc/tree-vect-loop.c 2013-03-04 12:17:09.934351015 +0100
> @@ -4487,8 +4487,9 @@ vect_finalize_reduction:
> }
>
> scalar_results.release ();
> + inner_phis.release ();
> new_phis.release ();
> -}
> +}
>
>
> /* Function vectorizable_reduction.
>
> Jakub
>
>
--
Richard Biener <rguenther@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-03-05 9:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-04 21:03 [PATCH] Fix vect_create_epilog_for_reduction memory leaks (PR middle-end/56461) Jakub Jelinek
2013-03-05 9:06 ` Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).