aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.cc
diff options
context:
space:
mode:
authorTamar Christina <tamar.christina@arm.com>2024-02-13 11:04:38 +0000
committerTamar Christina <tamar.christina@arm.com>2024-02-13 11:05:11 +0000
commit491e57451df47cda88f658601a92d6d006ae09d7 (patch)
tree6f6e067a6b0ab85f5bfb57b12519f2afe0b5ad3b /gcc/tree-vect-loop.cc
parent0d810b7d133c72b7e62b294ffaaf131560ce2391 (diff)
downloadgcc-491e57451df47cda88f658601a92d6d006ae09d7.zip
gcc-491e57451df47cda88f658601a92d6d006ae09d7.tar.gz
gcc-491e57451df47cda88f658601a92d6d006ae09d7.tar.bz2
middle-end: update vector loop upper bounds when early break vect [PR113734]
When doing early break vectorization we should treat the final iteration as possibly being partial. This so that when we calculate the vector loop upper bounds we take into account that final iteration could have done some work. The attached testcase shows that if we don't then cunroll may unroll the loop an if the upper bound is wrong we lose a vector iteration. This is similar to how we adjust the scalar loop bounds for the PEELED case. gcc/ChangeLog: PR tree-optimization/113734 * tree-vect-loop.cc (vect_transform_loop): Treat the final iteration of an early break loop as partial. gcc/testsuite/ChangeLog: PR tree-optimization/113734 * gcc.dg/vect/vect-early-break_117-pr113734.c: New test.
Diffstat (limited to 'gcc/tree-vect-loop.cc')
-rw-r--r--gcc/tree-vect-loop.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 04f4b5b..3670779 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -12174,7 +12174,8 @@ vect_transform_loop (loop_vec_info loop_vinfo, gimple *loop_vectorized_call)
/* True if the final iteration might not handle a full vector's
worth of scalar iterations. */
bool final_iter_may_be_partial
- = LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo);
+ = LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo)
+ || LOOP_VINFO_EARLY_BREAKS (loop_vinfo);
/* The minimum number of iterations performed by the epilogue. This
is 1 when peeling for gaps because we always need a final scalar
iteration. */