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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.4
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-03-25

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
OMP lowering makes the dead division conditional and we produce and want to
expand

;;   basic block 2, loop depth 0
;;    pred:       ENTRY
  MEM <vector(2) int> [(int *)&mask.4] = mask.5_9(D);
  vect__5.21_31 = .MASK_LOAD (&mask.4, 32B, { -1, -1, 0, 0, ... });
  _5 = mask.4[0];
  mask__26.22_33 = vect__5.21_31 != { 0, ... };
  _26 = _5 != 0;
  v_1 = .COND_DIV (_26, 1, 0, 1);
  vec_mask_and_37 = mask__26.22_33 & { -1, -1, 0, 0, ... };
  .MASK_STORE (&retval.3, 32B, vec_mask_and_37, { 0, ... });
  vectp_mask.19_29 = &mask.4 + POLY_INT_CST [16, 16];
  vectp_retval.23_36 = &retval.3 + POLY_INT_CST [16, 16];
  _6 = VIEW_CONVERT_EXPR<vector(2) int>(retval.3);
  return _6;
;;    succ:       EXIT

but that's still scalar, so sth forgot to "vectorize" it?  Indeed when
returning 'v' we instead get

  _26 = _5 != 0;
  vec_mask_and_37 = mask__26.34_33 & { -1, -1, -1, -1, 0, 0, 0, 0, ... };
  vect_v_1.35_38 = .COND_DIV (vec_mask_and_37, { 1, ... }, { 0, ... }, { 1, ...
});
  .MASK_STORE (&retval.9, 32B, vec_mask_and_37, vect_v_1.35_38);

The .COND_DIV is generated by if-conversion which supposedly expects we
will vectorize it (or throw it away) but it doesn't ignore (as the vectorizer)
obviously dead stmts.  So the bug is this disconnect between if-conversion
and vectorization.

Reply via email to