Patchwork Fix memory leak in vectorizable_conversion (PR middle-end/56461)

login
register
mail settings
Submitter Jakub Jelinek
Date March 1, 2013, 8:06 p.m.
Message ID <20130301200647.GD12913@tucnak.redhat.com>
Download mbox | patch
Permalink /patch/224437/
State New
Headers show

Comments

Jakub Jelinek - March 1, 2013, 8:06 p.m.
Hi!

For the modifier == NONE && !slp_node case we call vect_get_vec_defs, so
we overwrite vec_oprnds0, thus we shouldn't allocate it.

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-stmts.c (vectorizable_conversion): Don't call
	vec_oprnds0.create (1) for modifier == NONE.


	Jakub
Richard Guenther - March 4, 2013, 9:59 a.m.
On Fri, 1 Mar 2013, Jakub Jelinek wrote:

> Hi!
> 
> For the modifier == NONE && !slp_node case we call vect_get_vec_defs, so
> we overwrite vec_oprnds0, thus we shouldn't allocate it.
> 
> 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-stmts.c (vectorizable_conversion): Don't call
> 	vec_oprnds0.create (1) for modifier == NONE.
> 
> --- gcc/tree-vect-stmts.c.jj	2013-03-01 11:59:03.000000000 +0100
> +++ gcc/tree-vect-stmts.c	2013-03-01 12:39:08.521188115 +0100
> @@ -2616,15 +2616,13 @@ vectorizable_conversion (gimple stmt, gi
>  
>    if (!slp_node)
>      {
> -      if (modifier == NONE)
> -	vec_oprnds0.create (1);
> -      else if (modifier == WIDEN)
> +      if (modifier == WIDEN)
>  	{
>  	  vec_oprnds0.create (multi_step_cvt ? vect_pow2(multi_step_cvt) : 1);
>  	  if (op_type == binary_op)
>  	    vec_oprnds1.create (1);
>  	}
> -      else
> +      else if (modifier == NARROW)
>  	vec_oprnds0.create (
>  		   2 * (multi_step_cvt ? vect_pow2 (multi_step_cvt) : 1));
>      }
> 
> 	Jakub
> 
>

Patch

--- gcc/tree-vect-stmts.c.jj	2013-03-01 11:59:03.000000000 +0100
+++ gcc/tree-vect-stmts.c	2013-03-01 12:39:08.521188115 +0100
@@ -2616,15 +2616,13 @@  vectorizable_conversion (gimple stmt, gi
 
   if (!slp_node)
     {
-      if (modifier == NONE)
-	vec_oprnds0.create (1);
-      else if (modifier == WIDEN)
+      if (modifier == WIDEN)
 	{
 	  vec_oprnds0.create (multi_step_cvt ? vect_pow2(multi_step_cvt) : 1);
 	  if (op_type == binary_op)
 	    vec_oprnds1.create (1);
 	}
-      else
+      else if (modifier == NARROW)
 	vec_oprnds0.create (
 		   2 * (multi_step_cvt ? vect_pow2 (multi_step_cvt) : 1));
     }