https://gcc.gnu.org/g:c0de34cebd8719808bfbb375c30fb4c630eec253

commit r17-6430-gc0de34cebd8719808bfbb375c30fb4c630eec253
Author: Robin Dapp <[email protected]>
Date:   Thu Nov 5 09:43:40 2026 +0100

    vect: Do not set niters range for partial vect.
    
    In vect_do_peeling we set NITER's range info to [0, VF] when peeling for
    alignment but that's not conservative enough for partial vectorization
    where we could legitimately operate on just one scalar iteration.
    
    This patch guards the range set with !partial_vectors_p.
    
    gcc/ChangeLog:
    
            * tree-vect-loop-manip.cc (vect_do_peeling): Don't set niter
            range for partial vects.

Diff:
---
 gcc/tree-vect-loop-manip.cc | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
index 35884554ab4b..15756f5ef15d 100644
--- a/gcc/tree-vect-loop-manip.cc
+++ b/gcc/tree-vect-loop-manip.cc
@@ -3654,9 +3654,11 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, 
tree nitersm1,
        }
       bool new_var_p = false;
       niters = vect_build_loop_niters (loop_vinfo, &new_var_p);
-      /* It's guaranteed that vector loop bound before vectorization is at
-        least VF, so set range information for newly generated var.  */
-      if (new_var_p)
+      /* Without partial vectors, it's guaranteed that vector loop bound
+        before vectorization is at least VF, so set range information for
+        newly generated var.  */
+      if (new_var_p
+         && !LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo))
        {
          int_range<1> vr (type,
                           wi::to_wide (build_int_cst (type, lowest_vf)),

Reply via email to