Hi,
This is a pre-existing issue I noticed while testing early-break codegen
with RVV. I'm almost certain I intended to change this a long while ago
already but couldn't find a patch nor notes...
In vect_do_peeling we set NITER's range info to [0, VF] 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.
Bootstrapped and regtested on x86, power10, and aarch64.
Regtested on riscv64.
Regards
Robin
gcc/ChangeLog:
* tree-vect-loop-manip.cc (vect_do_peeling): Don't set niter
range for partial vects.
---
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 079cd97adcd..3eb0f336443 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)),
--
2.56.0