From: Martin Liska Date: Thu, 19 May 2016 15:08:02 +0000 (+0200) Subject: Fix memory leak in tree-vect-stmts.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=00426f9a9e57175d6373359aec3e7956a6d2a1c1;p=gcc.git Fix memory leak in tree-vect-stmts.c * tree-vect-stmts.c (vectorizable_simd_clone_call): Utilize auto_vec instead of vec. From-SVN: r236472 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8b30dea759c..883892bc1f9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-05-19 Martin Liska + + * tree-vect-stmts.c (vectorizable_simd_clone_call): Utilize + auto_vec instead of vec. + 2016-05-19 Martin Liska * tree-parloops.c (oacc_entry_exit_ok): Release a vector. diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 9ab4af4f97e..3bcd0ce1946 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 arginfo = vNULL; + auto_vec arginfo; vec 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; }