On Fri, 29 Sep 2023, Jakub Jelinek wrote:

> On Wed, Sep 27, 2023 at 11:15:26AM +0000, Richard Biener wrote:
> > > tree-vect-patterns.cc:2947  unprom.quick_grow (nops);
> > > T = vect_unpromoted_value
> > > Go for quick_grow_cleared?  Something else?
> > 
> > The CTOR zero-initializes everything, so maybe it can go.  In theory
> > .set_op could also be changed to .push_op ...
> 
> So, I had a look at this and I think using quick_grow_cleared is best choice
> here.  The nops is 2 or 1 most of the time, worst case 3, so the price of
> extra initialization of 4 pointer-sized-or-less members times 1, 2 or 3
> doesn't seem worth bothering, it is similar to the bitmap_head case where
> we already pay the price for just one structure anytime we do
>   vect_unpromoted_value unprom_diff;
> (and later set_op on it) or even
>   vect_unpromoted_value unprom0[2];
> 
> With this patch and Richard S's poly_int_pod removal the static_assert can
> be enabled as well and gcc builds.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

OK.

> The second patch waits for the poly_int_pod removal commit and has been just
> build tested but not bootstrapped yet.
> 
> 2023-09-29  Jakub Jelinek  <ja...@redhat.com>
> 
>       * tree-vect-patterns.cc (vect_recog_over_widening_pattern): Use
>       quick_grow_cleared method on unprom rather than quick_grow.
> 
> --- gcc/tree-vect-patterns.cc.jj      2023-08-24 15:37:29.321410276 +0200
> +++ gcc/tree-vect-patterns.cc 2023-09-29 09:45:27.980168865 +0200
> @@ -2944,7 +2944,7 @@ vect_recog_over_widening_pattern (vec_in
>    /* Check the operands.  */
>    unsigned int nops = gimple_num_ops (last_stmt) - first_op;
>    auto_vec <vect_unpromoted_value, 3> unprom (nops);
> -  unprom.quick_grow (nops);
> +  unprom.quick_grow_cleared (nops);
>    unsigned int min_precision = 0;
>    bool single_use_p = false;
>    for (unsigned int i = 0; i < nops; ++i)
> 
> 
>       Jakub
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)

Reply via email to