Message ID | 20130304210333.GS12913@tucnak.redhat.com |
---|---|
State | New |
Headers | show |
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 > >
--- 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.