public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/101801] New: vect_worthwhile_without_simd_p is broken
@ 2021-08-06 10:26 rguenth at gcc dot gnu.org
  2021-08-06 10:27 ` [Bug tree-optimization/101801] " rguenth at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-08-06 10:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101801
           Summary: vect_worthwhile_without_simd_p is broken
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

vect_worthwhile_without_simd_p is currently

bool
vect_worthwhile_without_simd_p (vec_info *vinfo, tree_code code)
{
  loop_vec_info loop_vinfo = dyn_cast <loop_vec_info> (vinfo);
  unsigned HOST_WIDE_INT value;
  return (loop_vinfo
          && LOOP_VINFO_VECT_FACTOR (loop_vinfo).is_constant (&value)
          && value >= vect_min_worthwhile_factor (code));
}

which means it's never worthwhile to BB vectorize.  Also the VF check
doesn't honor SLP so that a fully SLPed loop with VF == 1 is never
considered worthwhile to vectorize.

I ran into this beast when looking at vectorization of mask condition
operations like cond_mask1 & cond_mask2 which, for AVX512, have
integer mode but vectorizable_operation does

  /* Worthwhile without SIMD support?  Check only during analysis.  */
  if (!VECTOR_MODE_P (vec_mode)
      && !vec_stmt
      && !vect_worthwhile_without_simd_p (vinfo, code))
    {
      if (dump_enabled_p ())
        dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
                         "not worthwhile without SIMD support.\n");
      return false;
    }

and in my case with SLP the VF was indeed one and vectorization failed.
I think the code should not look at the vectorization factor but instead
at the vector type (and its number of components).

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-08-25  2:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-06 10:26 [Bug tree-optimization/101801] New: vect_worthwhile_without_simd_p is broken rguenth at gcc dot gnu.org
2021-08-06 10:27 ` [Bug tree-optimization/101801] " rguenth at gcc dot gnu.org
2021-08-06 11:09 ` rsandifo at gcc dot gnu.org
2021-08-06 11:12 ` rsandifo at gcc dot gnu.org
2021-08-06 11:21 ` rguenth at gcc dot gnu.org
2021-08-06 13:32 ` cvs-commit at gcc dot gnu.org
2021-08-06 13:33 ` rguenth at gcc dot gnu.org
2021-08-10  8:12 ` cvs-commit at gcc dot gnu.org
2021-08-25  2:32 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).