"Andre Vieira (lists)" <andre.simoesdiasvie...@arm.com> writes:
> Hi,
>
> As mentioned in the PR, this patch fixes up the nvectors parameter passed to 
> vect_get_loop_mask in vectorizable_condition.
> Before the STMT_VINFO_VEC_STMTS rework we used to handle each ncopy 
> separately, now we gather them all at the same time and don't need to 
> multiply vec_num with ncopies.
>
> The reduced testcase I used to illustrate the issue in the PR gives a 
> warning, if someone knows how to get rid of that (it's Fortran) I'd include 
> it as a testcase for this.

Looks like Richi's since posted one.

> Bootstrapped and regression tested on aarch64-none-linux-gnu. I don't believe 
> that code triggers for other targets, so not sure it makes sense to test on 
> others?
>
> Is this OK for trunk? Would you rather wait for the testcase?
>
> gcc/ChangeLog:
> 2021-02-05  Andre Vieira  <andre.simoesdiasvie...@arm.com>
>
>              PR middle-end/98974
>              * tree-vect-stmts.c (vectorizable_condition): Fix nvectors 
> parameter
>              for vect_get_loop_mask call.
>
> diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
> index 
> 0bc1cb1c5b4f6c1f0447241b4d31434bf7cca1a4..d07602f6d38f9c51936ac09942599fc5a14f46ab
>  100644
> --- a/gcc/tree-vect-stmts.c
> +++ b/gcc/tree-vect-stmts.c
> @@ -10237,8 +10237,7 @@ vectorizable_condition (vec_info *vinfo,
>           {
>             unsigned vec_num = vec_oprnds0.length ();
>             tree loop_mask
> -             = vect_get_loop_mask (gsi, masks, vec_num * ncopies,
> -                                   vectype, i);
> +             = vect_get_loop_mask (gsi, masks, vec_num, vectype, i);
>             tree tmp2 = make_ssa_name (vec_cmp_type);
>             gassign *g
>               = gimple_build_assign (tmp2, BIT_AND_EXPR, vec_compare,

Does removing the shadowed vec_num work?  I think that would be less
confusing, and means that the calculation stays in sync with the
vect_record_loop_mask call.

Thanks,
Richard

Reply via email to