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

--- Comment #4 from Kewen Lin <linkw at gcc dot gnu.org> ---
> gcc.target/powerpc/p9-vec-length-full-6.c

This is a test case issue, 64bit/32bit pairs will use full vector instead of
partial vector as Andrea's improvement.

> gcc.target/powerpc/p9-vec-length-epil-7.c

It exposed one problem: when we call vect_need_peeling_or_partial_vectors_p in
function vect_analyze_loop_2, it's in analysis stage, if the loop is one
epilogue loop, the loop_vinfo hasn't been fixed up, like LOOP_VINFO_INT_NITERS,
the function can probably give the wrong answer.  For some 64bit type functions
of this failed case, it will return false for the epilogue loops but actually
the remaining iteration can't cover the full vector.

One simple fix is to exclude epilogue loop for this check.

diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index ab627fbf029..7273e998a99 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -2278,7 +2278,8 @@ start_over:
     {
       /* Don't use partial vectors if we don't need to peel the loop.  */
       if (param_vect_partial_vector_usage == 0
-          || !vect_need_peeling_or_partial_vectors_p (loop_vinfo))
+          || (!LOOP_VINFO_EPILOGUE_P (loop_vinfo)
+              && !vect_need_peeling_or_partial_vectors_p (loop_vinfo)))
         LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo) = false;
       else if (vect_verify_full_masking (loop_vinfo)
                || vect_verify_loop_lens (loop_vinfo))

Testing is ongoing.

Reply via email to