[Bug tree-optimization/92772] wrong code vectorizing masked max

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Dec 4 10:25:00 GMT 2019


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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
And the issue is to be fixed in vect_create_epilog_for_reduction where
we create the index IV:

  /* For cond reductions we want to create a new vector (INDEX_COND_EXPR)
     which is updated with the current index of the loop for every match of
     the original loop's cond_expr (VEC_STMT).  This results in a vector
     containing the last time the condition passed for that vector lane.
     The first match will be a 1 to allow 0 to be used for non-matching
     indexes.  If there are no matches at all then the vector will be all
     zeroes.  */
  if (STMT_VINFO_REDUC_TYPE (reduc_info) == COND_REDUCTION)
    {

and the masking support needs to be added similarly to how
vectorizable_condition
handles it.


More information about the Gcc-bugs mailing list