[PATCH 9/9] Fix memory leak in tree-vect-stmts.c
Richard Biener
richard.guenther@gmail.com
Thu May 19 11:17:00 GMT 2016
On Thu, May 19, 2016 at 12:44 PM, marxin <mliska@suse.cz> wrote:
> The leak can be seen here:
> gcc pr60823-2.c -fno-diagnostics-show-caret -fdiagnostics-color=never -O2 \
> -fopenmp-simd
Ok.
Richard.
> gcc/ChangeLog:
>
> 2016-05-18 Martin Liska <mliska@suse.cz>
>
> * tree-vect-stmts.c (vectorizable_simd_clone_call): Utilize
> auto_vec instead of vec.
> ---
> gcc/tree-vect-stmts.c | 21 +++++----------------
> 1 file changed, 5 insertions(+), 16 deletions(-)
>
> diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
> index 9ab4af4..3bcd0ce 100644
> --- a/gcc/tree-vect-stmts.c
> +++ b/gcc/tree-vect-stmts.c
> @@ -2755,7 +2755,7 @@ vectorizable_simd_clone_call (gimple *stmt, gimple_stmt_iterator *gsi,
> gimple *def_stmt;
> gimple *new_stmt = NULL;
> int ncopies, j;
> - vec<simd_call_arg_info> arginfo = vNULL;
> + auto_vec<simd_call_arg_info> arginfo;
> vec<tree> vargs = vNULL;
> size_t i, nargs;
> tree lhs, rtype, ratype;
> @@ -2802,7 +2802,7 @@ vectorizable_simd_clone_call (gimple *stmt, gimple_stmt_iterator *gsi,
> if (nargs == 0)
> return false;
>
> - arginfo.create (nargs);
> + arginfo.reserve (nargs, true);
>
> for (i = 0; i < nargs; i++)
> {
> @@ -2822,7 +2822,6 @@ vectorizable_simd_clone_call (gimple *stmt, gimple_stmt_iterator *gsi,
> if (dump_enabled_p ())
> dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
> "use not simple.\n");
> - arginfo.release ();
> return false;
> }
>
> @@ -2978,10 +2977,7 @@ vectorizable_simd_clone_call (gimple *stmt, gimple_stmt_iterator *gsi,
> }
>
> if (bestn == NULL)
> - {
> - arginfo.release ();
> - return false;
> - }
> + return false;
>
> for (i = 0; i < nargs; i++)
> if ((arginfo[i].dt == vect_constant_def
> @@ -2994,10 +2990,7 @@ vectorizable_simd_clone_call (gimple *stmt, gimple_stmt_iterator *gsi,
> if (arginfo[i].vectype == NULL
> || (TYPE_VECTOR_SUBPARTS (arginfo[i].vectype)
> > bestn->simdclone->simdlen))
> - {
> - arginfo.release ();
> - return false;
> - }
> + return false;
> }
>
> fndecl = bestn->decl;
> @@ -3009,10 +3002,7 @@ vectorizable_simd_clone_call (gimple *stmt, gimple_stmt_iterator *gsi,
> performed using SIMD instructions. */
> if ((loop == NULL || (unsigned) loop->safelen < nunits)
> && gimple_vuse (stmt))
> - {
> - arginfo.release ();
> - return false;
> - }
> + return false;
>
> /* Sanity check: make sure that at least one copy of the vectorized stmt
> needs to be generated. */
> @@ -3041,7 +3031,6 @@ vectorizable_simd_clone_call (gimple *stmt, gimple_stmt_iterator *gsi,
> dump_printf_loc (MSG_NOTE, vect_location,
> "=== vectorizable_simd_clone_call ===\n");
> /* vect_model_simple_cost (stmt_info, ncopies, dt, NULL, NULL); */
> - arginfo.release ();
> return true;
> }
>
> --
> 2.8.2
>
More information about the Gcc-patches
mailing list