https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98526

--- Comment #4 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> 
---
(In reply to Richard Biener from comment #2)
> Created attachment 49937 [details]
> patch
> 
> Sth like this.  But I'm somewhat confused about the partial vector code in
> the
> "else" branch:
> 
>   /* All but single defuse-cycle optimized, lane-reducing and fold-left
>      reductions go through their own vectorizable_* routines.  */
>   if (!single_defuse_cycle
>       && code != DOT_PROD_EXPR
>       && code != WIDEN_SUM_EXPR
>       && code != SAD_EXPR
>       && reduction_type != FOLD_LEFT_REDUCTION)
>     {
>       stmt_vec_info tem
>         = vect_stmt_to_vectorize (STMT_VINFO_REDUC_DEF (phi_info));
>       if (slp_node && REDUC_GROUP_FIRST_ELEMENT (tem))
>         {
>           gcc_assert (!REDUC_GROUP_NEXT_ELEMENT (tem));
>           tem = REDUC_GROUP_FIRST_ELEMENT (tem);
>         }
>       STMT_VINFO_DEF_TYPE (vect_orig_stmt (tem)) = vect_internal_def;
>       STMT_VINFO_DEF_TYPE (tem) = vect_internal_def;
>     }
>   else if (loop_vinfo && LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P (loop_vinfo))
>     {
>       vec_loop_masks *masks = &LOOP_VINFO_MASKS (loop_vinfo);
> 
> why is this only relevant when we go via vect_transform_reduction?  This
> looks
> like a bit like a misplaced bunch of checks?
The code predates the rework of reductions, so it might not
be written in the most natural way for the current structure.
But the idea is that the analysis phase of each vectorizable_*
routine should do its own CAN_USE_PARTIAL_VECTORS_P checks,
based on what it needs to do during the transform phase.
So vectorizable_reduction should only test the stuff that the
vect_transform_reduction and the epilogue code need.

Reply via email to