This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Small tree-vect-pattern.c cleanup
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 15 Jun 2012 11:20:32 +0200
- Subject: Re: [PATCH] Small tree-vect-pattern.c cleanup
- References: <20120614210017.GG24904@tucnak.redhat.com>
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