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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
So it's interesting, we somehow get a AVX vectorized main loop with a AVX512
vectorized masked epilog.  It must have sth to do with max-iterations vs.
actually known ones, but

static const double a[] = { 1., 2., 3., 4., 5. };

void foo (double *b, double c, int n)
{
  for (int i = 0; i < n; ++i)
    b[i] = a[i] * c;
}

behaves sanely.  Still the following makes us ICE compiling
the offending file from SPEC.  I'm reducing now since I'm obviously
missing something here.  Note that the above, with --param
vect-partial-vector-usage=1 gets us an "epilogue-only" vectorization
using masked AVX512 which was unexpected but kind-of makes sense.

diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 2782d61a5fc..5e12fe0e213 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -3757,6 +3757,8 @@ vect_analyze_loop (class loop *loop, gimple
*loop_vectorized_call,

          if (loop_vinfo)
            {
+             gcc_assert (known_ge (first_vinfo_vf,
+                                   LOOP_VINFO_VECT_FACTOR (loop_vinfo)));
              if (pick_lowest_cost_p
                  && orig_loop_vinfo->epilogue_vinfo
                  && vect_joust_loop_vinfos (loop_vinfo,

Reply via email to