https://gcc.gnu.org/g:0a46245174123ad2802753e7fee689a541570ca0

commit r15-6808-g0a46245174123ad2802753e7fee689a541570ca0
Author: Alex Coplan <alex.cop...@arm.com>
Date:   Fri Jun 7 11:13:02 2024 +0000

    vect: Don't guard scalar epilogue for inverted loops [PR118211]
    
    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:
    
            PR tree-optimization/118211
            PR tree-optimization/116126
            * tree-vect-loop-manip.cc (vect_do_peeling): Avoid emitting an
            epilogue guard for inverted early-exit loops.

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

diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
index 15cac0fe27df..4505e5d87ddb 100644
--- a/gcc/tree-vect-loop-manip.cc
+++ b/gcc/tree-vect-loop-manip.cc
@@ -3530,7 +3530,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);

Reply via email to