This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] fix memory leak in tree-vect-slp.c


On Wed, Jun 2, 2010 at 2:18 AM, Ira Rosen <IRAR@il.ibm.com> wrote:
>
>
> gcc-patches-owner@gcc.gnu.org wrote on 01/06/2010 11:58:49 PM:
>
>>
>> This patch fixes a memory leak in tree-vect-slp.c. ?We free a local
>> variable on each trip around the loop, then we allocate. ?We could move
>> the free call further down the loop to fix the memory leak.
>>
>> But why bother with allocation at all? ?gimple_build_call will do what
>> we want without the allocation that gimple_build_call_vec requires. ?So
>> use that instead.
>>
>> Tested on x86_64-unknown-linux-gnu. ?OK to commit?
>
> OK.
>
> Thanks,
> Ira
>
>>
>> -Nathan
>>
>> ? ?* tree-vect-slp.c (vect_create_mask_and_perm): Use gimple_build_call
>> ? ?instead of gimple_build_call_vec. ?Delete unnecessary local variable.
>>
>> Index: tree-vect-slp.c
>> ===================================================================
>> --- tree-vect-slp.c ? (revision 160119)
>> +++ tree-vect-slp.c ? (working copy)
>> @@ -1925,7 +1925,6 @@ vect_create_mask_and_perm (gimple stmt,
>> ? ?stmt_vec_info next_stmt_info;
>> ? ?int i, stride;
>> ? ?tree first_vec, second_vec, data_ref;
>> - ?VEC (tree, heap) *params = NULL;
>>
>> ? ?stride = SLP_TREE_NUMBER_OF_VEC_STMTS (node) / ncopies;
>>
>> @@ -1941,15 +1940,9 @@ vect_create_mask_and_perm (gimple stmt,
>> ? ? ? ?first_vec = VEC_index (tree, dr_chain, first_vec_indx);
>> ? ? ? ?second_vec = VEC_index (tree, dr_chain, second_vec_indx);
>>
>> - ? ? ?/* Build argument list for the vectorized call. ?*/
>> - ? ? ?VEC_free (tree, heap, params);
>> - ? ? ?params = VEC_alloc (tree, heap, 3);
>> - ? ? ?VEC_quick_push (tree, params, first_vec);
>> - ? ? ?VEC_quick_push (tree, params, second_vec);
>> - ? ? ?VEC_quick_push (tree, params, mask);
>> -
>> ? ? ? ?/* Generate the permute statement. ?*/
>> - ? ? ?perm_stmt = gimple_build_call_vec (builtin_decl, params);
>> + ? ? ?perm_stmt = gimple_build_call (builtin_decl,
>> + ? ? ? ? ? ? ? ? 3, first_vec, second_vec, mask);
>> ? ? ? ?data_ref = make_ssa_name (perm_dest, perm_stmt);
>> ? ? ? ?gimple_call_set_lhs (perm_stmt, data_ref);
>> ? ? ? ?vect_finish_stmt_generation (stmt, perm_stmt, gsi);
>
>

Ping - Has this been committed yet?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]