diff mbox

Small tree-vect-pattern.c cleanup

Message ID 20120614210017.GG24904@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek June 14, 2012, 9 p.m. UTC
Hi!

While looking at pattern recognizer, I've noticed that we needlessly
allocate a single member array from heap.  An automatic variable for that
would be fine, but BB_VINFO_BB is also addressable.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2012-06-14  Jakub Jelinek  <jakub@redhat.com>

	* tree-vect-patterns.c (vect_pattern_recog): Don't unnecessarily
	allocate and free bbs array for the SLP case.


	Jakub

Comments

Richard Biener June 15, 2012, 9:20 a.m. UTC | #1
On Thu, Jun 14, 2012 at 11:00 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> While looking at pattern recognizer, I've noticed that we needlessly
> allocate a single member array from heap.  An automatic variable for that
> would be fine, but BB_VINFO_BB is also addressable.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Ok.

Thanks,
Richard.

> 2012-06-14  Jakub Jelinek  <jakub@redhat.com>
>
>        * tree-vect-patterns.c (vect_pattern_recog): Don't unnecessarily
>        allocate and free bbs array for the SLP case.
>
> --- gcc/tree-vect-patterns.c.jj 2012-06-14 13:22:27.000000000 +0200
> +++ gcc/tree-vect-patterns.c    2012-06-14 15:33:16.335453016 +0200
> @@ -2983,7 +2983,7 @@ void
>  vect_pattern_recog (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
>  {
>   struct loop *loop;
> -  basic_block *bbs, bb;
> +  basic_block *bbs;
>   unsigned int nbbs;
>   gimple_stmt_iterator si;
>   unsigned int i, j;
> @@ -3002,10 +3002,8 @@ vect_pattern_recog (loop_vec_info loop_v
>     }
>   else
>     {
> -      bb = BB_VINFO_BB (bb_vinfo);
> +      bbs = &BB_VINFO_BB (bb_vinfo);
>       nbbs = 1;
> -      bbs = XNEW (basic_block);
> -      bbs[0] = bb;
>     }
>
>   /* Scan through the loop stmts, applying the pattern recognition
> @@ -3031,6 +3029,4 @@ vect_pattern_recog (loop_vec_info loop_v
>     }
>
>   VEC_free (gimple, heap, stmts_to_replace);
> -  if (bb_vinfo)
> -    free (bbs);
>  }
>
>        Jakub
diff mbox

Patch

--- gcc/tree-vect-patterns.c.jj	2012-06-14 13:22:27.000000000 +0200
+++ gcc/tree-vect-patterns.c	2012-06-14 15:33:16.335453016 +0200
@@ -2983,7 +2983,7 @@  void
 vect_pattern_recog (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
 {
   struct loop *loop;
-  basic_block *bbs, bb;
+  basic_block *bbs;
   unsigned int nbbs;
   gimple_stmt_iterator si;
   unsigned int i, j;
@@ -3002,10 +3002,8 @@  vect_pattern_recog (loop_vec_info loop_v
     }
   else
     {
-      bb = BB_VINFO_BB (bb_vinfo);
+      bbs = &BB_VINFO_BB (bb_vinfo);
       nbbs = 1;
-      bbs = XNEW (basic_block);
-      bbs[0] = bb;
     }
 
   /* Scan through the loop stmts, applying the pattern recognition
@@ -3031,6 +3029,4 @@  vect_pattern_recog (loop_vec_info loop_v
     }
 
   VEC_free (gimple, heap, stmts_to_replace);
-  if (bb_vinfo)
-    free (bbs);
 }