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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
The to be vectorized IL is

  <bb 4> [local count: 118111600]:
  # i_21 = PHI <i_18(12), i_14(27)>
  _2 = (int) i_21;
  _32 = &(*d_16(D))[_2];
  _3 = .MASK_LOAD (_32, 32B, h_15(D));
  _5 = _3 != 0;
  _23 = _5 & h_15(D);
  prephitmp_36 = _23 ? 1 : 0;
  i.3_6 = (unsigned short) i_21;
  _7 = i.3_6 + 1;
  i_18 = (short int) _7;
  if (i_18 != 0)
    goto <bb 12>; [89.00%]
  else
    goto <bb 10>; [11.00%]

  <bb 12> [local count: 105119324]:
  goto <bb 4>; [100.00%]

and the issue is that the mask is an invariant but we're just using
vect_get_vec_defs_for_operand and that does

  if (dt == vect_constant_def || dt == vect_external_def)
    {
      tree stmt_vectype = STMT_VINFO_VECTYPE (stmt_vinfo);
      tree vector_type;

      if (vectype)
        vector_type = vectype;
      else if (VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (op))
               && VECTOR_BOOLEAN_TYPE_P (stmt_vectype))
        vector_type = truth_type_for (stmt_vectype);

but of course stmt_vectype is not a boolean type but V8SI.

Reply via email to