diff mbox series

[RFC,2/5] vect: Don't guard scalar epilogue for inverted loops

Message ID Zx+lvBVnlc+yMcCv@arm.com
State New
Headers show
Series vect: Force peeling for alignment to handle more early break loops | expand

Commit Message

Alex Coplan Oct. 28, 2024, 2:54 p.m. UTC
For loops with LOOP_VINFO_EARLY_BREAKS_VECT_PEELED we should always
enter the scalar epilogue, so avoid emitting a guard on entry to the
epilogue.

gcc/ChangeLog:

	* tree-vect-loop-manip.cc (vect_do_peeling): Avoid emitting an
	epilogue guard for inverted early-exit loops.
---
 gcc/tree-vect-loop-manip.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Richard Biener Oct. 29, 2024, 12:40 p.m. UTC | #1
On Mon, 28 Oct 2024, Alex Coplan wrote:

> For loops with LOOP_VINFO_EARLY_BREAKS_VECT_PEELED we should always
> enter the scalar epilogue, so avoid emitting a guard on entry to the
> epilogue.

OK.  I guess this can go in independently?

Richard.

> gcc/ChangeLog:
> 
> 	* tree-vect-loop-manip.cc (vect_do_peeling): Avoid emitting an
> 	epilogue guard for inverted early-exit loops.
> ---
>  gcc/tree-vect-loop-manip.cc | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
>
diff mbox series

Patch

diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
index 718652f9bd8..8eb9970edbc 100644
--- a/gcc/tree-vect-loop-manip.cc
+++ b/gcc/tree-vect-loop-manip.cc
@@ -3537,7 +3537,9 @@  vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
 
       /* If we have a peeled vector iteration we will never skip the epilog loop
 	 and we can simplify the cfg a lot by not doing the edge split.  */
-      if (skip_epilog || LOOP_VINFO_EARLY_BREAKS (loop_vinfo))
+      if (skip_epilog
+	  || (LOOP_VINFO_EARLY_BREAKS (loop_vinfo)
+	      && !LOOP_VINFO_EARLY_BREAKS_VECT_PEELED (loop_vinfo)))
 	{
 	  guard_cond = fold_build2 (EQ_EXPR, boolean_type_node,
 				    niters, niters_vector_mult_vf);