* [PATCH] Fix vectorizable_store memory leaks (PR middle-end/56461)
@ 2013-03-01 20:23 Jakub Jelinek
2013-03-01 22:41 ` Jeff Law
2013-03-04 10:01 ` Richard Biener
0 siblings, 2 replies; 3+ messages in thread
From: Jakub Jelinek @ 2013-03-01 20:23 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches
Hi!
The first two hunks are similar issue to what I've posted for
vect_permute_load_chain two days ago, the remaining issue is that
if ncopies > 1, we'd leak the result_chain vector too.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?
2013-03-01 Jakub Jelinek <jakub@redhat.com>
PR middle-end/56461
* tree-vect-data-refs.c (vect_permute_store_chain): Avoid using copy
method on dr_chain and result_chain.
* tree-vect-stmts.c (vectorizable_store): Only call
result_chain.create if j == 0.
--- gcc/tree-vect-data-refs.c.jj 2013-02-27 23:05:57.000000000 +0100
+++ gcc/tree-vect-data-refs.c 2013-03-01 17:41:12.296992793 +0100
@@ -4218,7 +4218,9 @@ vect_permute_store_chain (vec<tree> dr_c
unsigned int j, nelt = TYPE_VECTOR_SUBPARTS (vectype);
unsigned char *sel = XALLOCAVEC (unsigned char, nelt);
- *result_chain = dr_chain.copy ();
+ result_chain->quick_grow (length);
+ memcpy (result_chain->address (), dr_chain.address (),
+ length * sizeof (tree));
for (i = 0, n = nelt / 2; i < n; i++)
{
@@ -4259,7 +4261,8 @@ vect_permute_store_chain (vec<tree> dr_c
vect_finish_stmt_generation (stmt, perm_stmt, gsi);
(*result_chain)[2*j+1] = low;
}
- dr_chain = result_chain->copy ();
+ memcpy (dr_chain.address (), result_chain->address (),
+ length * sizeof (tree));
}
}
--- gcc/tree-vect-stmts.c.jj 2013-03-01 13:33:37.000000000 +0100
+++ gcc/tree-vect-stmts.c 2013-03-01 17:35:17.146958118 +0100
@@ -4135,7 +4135,8 @@ vectorizable_store (gimple stmt, gimple_
new_stmt = NULL;
if (grouped_store)
{
- result_chain.create (group_size);
+ if (j == 0)
+ result_chain.create (group_size);
/* Permute. */
vect_permute_store_chain (dr_chain, group_size, stmt, gsi,
&result_chain);
Jakub
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix vectorizable_store memory leaks (PR middle-end/56461)
2013-03-01 20:23 [PATCH] Fix vectorizable_store memory leaks (PR middle-end/56461) Jakub Jelinek
@ 2013-03-01 22:41 ` Jeff Law
2013-03-04 10:01 ` Richard Biener
1 sibling, 0 replies; 3+ messages in thread
From: Jeff Law @ 2013-03-01 22:41 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Richard Biener, gcc-patches
On 03/01/2013 01:23 PM, Jakub Jelinek wrote:
> Hi!
>
> The first two hunks are similar issue to what I've posted for
> vect_permute_load_chain two days ago, the remaining issue is that
> if ncopies > 1, we'd leak the result_chain vector too.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?
>
> 2013-03-01 Jakub Jelinek <jakub@redhat.com>
>
> PR middle-end/56461
> * tree-vect-data-refs.c (vect_permute_store_chain): Avoid using copy
> method on dr_chain and result_chain.
> * tree-vect-stmts.c (vectorizable_store): Only call
> result_chain.create if j == 0.
This is fine. Please install. Thanks.
Jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix vectorizable_store memory leaks (PR middle-end/56461)
2013-03-01 20:23 [PATCH] Fix vectorizable_store memory leaks (PR middle-end/56461) Jakub Jelinek
2013-03-01 22:41 ` Jeff Law
@ 2013-03-04 10:01 ` Richard Biener
1 sibling, 0 replies; 3+ messages in thread
From: Richard Biener @ 2013-03-04 10:01 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gcc-patches
On Fri, 1 Mar 2013, Jakub Jelinek wrote:
> Hi!
>
> The first two hunks are similar issue to what I've posted for
> vect_permute_load_chain two days ago, the remaining issue is that
> if ncopies > 1, we'd leak the result_chain vector too.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?
Ok.
Thanks,
Richard.
> 2013-03-01 Jakub Jelinek <jakub@redhat.com>
>
> PR middle-end/56461
> * tree-vect-data-refs.c (vect_permute_store_chain): Avoid using copy
> method on dr_chain and result_chain.
> * tree-vect-stmts.c (vectorizable_store): Only call
> result_chain.create if j == 0.
>
> --- gcc/tree-vect-data-refs.c.jj 2013-02-27 23:05:57.000000000 +0100
> +++ gcc/tree-vect-data-refs.c 2013-03-01 17:41:12.296992793 +0100
> @@ -4218,7 +4218,9 @@ vect_permute_store_chain (vec<tree> dr_c
> unsigned int j, nelt = TYPE_VECTOR_SUBPARTS (vectype);
> unsigned char *sel = XALLOCAVEC (unsigned char, nelt);
>
> - *result_chain = dr_chain.copy ();
> + result_chain->quick_grow (length);
> + memcpy (result_chain->address (), dr_chain.address (),
> + length * sizeof (tree));
>
> for (i = 0, n = nelt / 2; i < n; i++)
> {
> @@ -4259,7 +4261,8 @@ vect_permute_store_chain (vec<tree> dr_c
> vect_finish_stmt_generation (stmt, perm_stmt, gsi);
> (*result_chain)[2*j+1] = low;
> }
> - dr_chain = result_chain->copy ();
> + memcpy (dr_chain.address (), result_chain->address (),
> + length * sizeof (tree));
> }
> }
>
> --- gcc/tree-vect-stmts.c.jj 2013-03-01 13:33:37.000000000 +0100
> +++ gcc/tree-vect-stmts.c 2013-03-01 17:35:17.146958118 +0100
> @@ -4135,7 +4135,8 @@ vectorizable_store (gimple stmt, gimple_
> new_stmt = NULL;
> if (grouped_store)
> {
> - result_chain.create (group_size);
> + if (j == 0)
> + result_chain.create (group_size);
> /* Permute. */
> vect_permute_store_chain (dr_chain, group_size, stmt, gsi,
> &result_chain);
>
> 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] 3+ messages in thread
end of thread, other threads:[~2013-03-04 10:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-01 20:23 [PATCH] Fix vectorizable_store memory leaks (PR middle-end/56461) Jakub Jelinek
2013-03-01 22:41 ` Jeff Law
2013-03-04 10:01 ` 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).