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]

[PATCH] Small tree-vect-pattern.c cleanup


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.

--- 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


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