]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
vect: Extend `vec_init_loop_exit_info' to handle uncounted loops
authorVictor Do Nascimento <victor.donascimento@arm.com>
Mon, 22 Sep 2025 09:50:25 +0000 (10:50 +0100)
committerVictor Do Nascimento <victor.donascimento@arm.com>
Mon, 15 Dec 2025 15:17:50 +0000 (15:17 +0000)
In its current implementation, the loop vectorizer requires the main
exit be the counting IV exit. With uncounted loops we no longer need
to have any counting IV exits.  Furthermore, it is possible to have
reached this stage with malformed loops with no exits at all.

Consequently, we need an approach to handle malformed loops and some
logic to follow when choosing the main exit, when counting IV is no
longer a valid criterion.

For malformed loops, it is sufficient to return NULL, so that we can
reject such loops upon the function return.

In the case of multiple exits and no counting IV exit, we choose the
last one in the loop.  This is done so that we continue to have an
empty effective latch.

As a consequence of allowing the main exit to no longer be associated
with IV counting, the old nomenclature of `LOOP_VINFO_IV_EXIT' and
`vec_loop_iv_exit' no longer fully cover the usage of such fields and
accessors.  With that in mind, these are modified to replace "IV" for
"MAIN" for these.

gcc/ChangeLog:

* tree-vectorizer.h (LOOP_VINFO_IV_EXIT): Replace this...
(LOOP_VINFO_MAIN_EXIT): ...with this.
(LOOP_VINFO_EPILOGUE_IV_EXIT): Replace this...
(LOOP_VINFO_EPILOGUE_MAIN_EXIT): ...with this.
(LOOP_VINFO_SCALAR_IV_EXIT): Replace this...
(LOOP_VINFO_SCALAR_MAIN_EXIT): ...with this.
(class _loop_vec_info): s/iv/main for `vec_loop_iv_exit',
`vec_epilogue_loop_main_exit' and `scalar_loop_main_exit'
class members.
* tree-vect-data-refs.cc
(vect_enhance_data_refs_alignment):
s/LOOP_VINFO_IV_EXIT/LOOP_VINFO_MAIN_EXIT/.
* tree-vect-loop-manip.cc
(vect_set_loop_controls_directly): Likewise.
(vect_gen_vector_loop_niters_mult_vf): Likewise.
(vect_loop_versioning): Likewise.
(vect_do_peeling):
s/LOOP_VINFO_IV_EXIT/LOOP_VINFO_MAIN_EXIT/,
s/LOOP_VINFO_SCALAR_IV_EXIT/LOOP_VINFO_SCALAR_MAIN_EXIT,
s/LOOP_VINFO_EPILOGUE_IV_EXIT/LOOP_VINFO_EPILOGUE_MAIN_EXIT.
* tree-vect-loop.cc (_loop_vec_info::_loop_vec_info):
s/iv_exit/main_exit/ in initializer list.
(vec_init_loop_exit_info): Handle multiple-exit uncounted loops.
(vect_analyze_loop_form): Fix `failure_at' message.
(vect_create_loop_vinfo):
s/LOOP_VINFO_IV_EXIT/LOOP_VINFO_MAIN_EXIT/.
(vect_create_epilog_for_reduction): Likewise.
(vectorizable_live_operation): Likewise.
(vect_update_ivs_after_vectorizer_for_early_breaks): Likewise.
(vect_transform_loop):
s/LOOP_VINFO_IV_EXIT/LOOP_VINFO_MAIN_EXIT/,
s/LOOP_VINFO_SCALAR_IV_EXIT/LOOP_VINFO_SCALAR_MAIN_EXIT.
* tree-vectorizer.cc (set_uid_loop_bbs):
s/LOOP_VINFO_SCALAR_IV_EXIT/LOOP_VINFO_SCALAR_MAIN_EXIT.

gcc/tree-vect-data-refs.cc
gcc/tree-vect-loop-manip.cc
gcc/tree-vect-loop.cc
gcc/tree-vectorizer.cc
gcc/tree-vectorizer.h

index b35ba05fd08b983a99a14e0ce50b6a6febf55909..154bf5ac1b66162dc428d84f3e208ea31ebc2ad0 100644 (file)
@@ -2590,7 +2590,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
 
   /* Check if we can possibly peel the loop.  */
   if (!vect_can_advance_ivs_p (loop_vinfo)
-      || !slpeel_can_duplicate_loop_p (loop, LOOP_VINFO_IV_EXIT (loop_vinfo),
+      || !slpeel_can_duplicate_loop_p (loop, LOOP_VINFO_MAIN_EXIT (loop_vinfo),
                                       loop_preheader_edge (loop))
       || loop->inner
       /* We don't currently maintaing the LCSSA for prologue peeled inversed
index bf60628a2896408396087f534ca590e6ce543d38..697836766eafe548c8e79327af35a86f65412c99 100644 (file)
@@ -545,7 +545,7 @@ vect_set_loop_controls_directly (class loop *loop, loop_vec_info loop_vinfo,
   tree index_before_incr, index_after_incr;
   gimple_stmt_iterator incr_gsi;
   bool insert_after;
-  edge exit_e = LOOP_VINFO_IV_EXIT (loop_vinfo);
+  edge exit_e = LOOP_VINFO_MAIN_EXIT (loop_vinfo);
   vect_iv_increment_position (exit_e, &incr_gsi, &insert_after);
   if (LOOP_VINFO_USING_DECREMENTING_IV_P (loop_vinfo))
     {
@@ -2951,7 +2951,7 @@ vect_gen_vector_loop_niters_mult_vf (loop_vec_info loop_vinfo,
   int vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo).to_constant ();
   tree type = TREE_TYPE (niters_vector);
   tree tree_vf = build_int_cst (type, vf);
-  basic_block exit_bb = LOOP_VINFO_IV_EXIT (loop_vinfo)->dest;
+  basic_block exit_bb = LOOP_VINFO_MAIN_EXIT (loop_vinfo)->dest;
 
   gcc_assert (niters_vector_mult_vf_ptr != NULL);
   tree niters_vector_mult_vf = fold_build2 (MULT_EXPR, type,
@@ -3379,19 +3379,19 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
         use the original scalar loop as remaining epilogue if necessary.  */
       LOOP_VINFO_SCALAR_LOOP (epilogue_vinfo)
        = LOOP_VINFO_SCALAR_LOOP (loop_vinfo);
-      LOOP_VINFO_SCALAR_IV_EXIT (epilogue_vinfo)
-       = LOOP_VINFO_SCALAR_IV_EXIT (loop_vinfo);
+      LOOP_VINFO_SCALAR_MAIN_EXIT (epilogue_vinfo)
+       = LOOP_VINFO_SCALAR_MAIN_EXIT (loop_vinfo);
     }
 
   if (prolog_peeling)
     {
       e = loop_preheader_edge (loop);
-      edge exit_e = LOOP_VINFO_IV_EXIT (loop_vinfo);
+      edge exit_e = LOOP_VINFO_MAIN_EXIT (loop_vinfo);
       gcc_checking_assert (slpeel_can_duplicate_loop_p (loop, exit_e, e)
                           && !LOOP_VINFO_EARLY_BREAKS_VECT_PEELED (loop_vinfo));
 
       /* Peel prolog and put it on preheader edge of loop.  */
-      edge scalar_e = LOOP_VINFO_SCALAR_IV_EXIT (loop_vinfo);
+      edge scalar_e = LOOP_VINFO_SCALAR_MAIN_EXIT (loop_vinfo);
       edge prolog_e = NULL;
       prolog = slpeel_tree_duplicate_loop_to_edge_cfg (loop, exit_e,
                                                       scalar_loop, scalar_e,
@@ -3479,7 +3479,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
 
   if (epilog_peeling)
     {
-      e = LOOP_VINFO_IV_EXIT (loop_vinfo);
+      e = LOOP_VINFO_MAIN_EXIT (loop_vinfo);
       gcc_checking_assert (slpeel_can_duplicate_loop_p (loop, e, e));
 
       /* Peel epilog and put it on exit edge of loop.  If we are vectorizing
@@ -3489,7 +3489,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
         If we are not vectorizing the epilog then we should use the scalar loop
         as the transformations mentioned above make less or no sense when not
         vectorizing.  */
-      edge scalar_e = LOOP_VINFO_SCALAR_IV_EXIT (loop_vinfo);
+      edge scalar_e = LOOP_VINFO_SCALAR_MAIN_EXIT (loop_vinfo);
       epilog = vect_epilogues ? get_loop_copy (loop) : scalar_loop;
       edge epilog_e = vect_epilogues ? e : scalar_e;
       edge new_epilog_e = NULL;
@@ -3498,7 +3498,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
        = slpeel_tree_duplicate_loop_to_edge_cfg (loop, e, epilog, epilog_e, e,
                                                  &new_epilog_e, true, &doms);
 
-      LOOP_VINFO_EPILOGUE_IV_EXIT (loop_vinfo) = new_epilog_e;
+      LOOP_VINFO_EPILOGUE_MAIN_EXIT (loop_vinfo) = new_epilog_e;
       gcc_assert (epilog);
       gcc_assert (new_epilog_e);
       epilog->force_vectorize = false;
@@ -3604,7 +3604,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
       gcc_checking_assert (vect_can_advance_ivs_p (loop_vinfo));
       update_e = skip_vector ? e : loop_preheader_edge (epilog);
       if (LOOP_VINFO_EARLY_BREAKS (loop_vinfo))
-       update_e = single_succ_edge (LOOP_VINFO_IV_EXIT (loop_vinfo)->dest);
+       update_e = single_succ_edge (LOOP_VINFO_MAIN_EXIT (loop_vinfo)->dest);
 
       /* 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.  */
@@ -3615,8 +3615,8 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
          guard_cond = fold_build2 (EQ_EXPR, boolean_type_node,
                                    niters, niters_vector_mult_vf);
 
-         guard_bb = LOOP_VINFO_IV_EXIT (loop_vinfo)->dest;
-         edge epilog_e = LOOP_VINFO_EPILOGUE_IV_EXIT (loop_vinfo);
+         guard_bb = LOOP_VINFO_MAIN_EXIT (loop_vinfo)->dest;
+         edge epilog_e = LOOP_VINFO_EPILOGUE_MAIN_EXIT (loop_vinfo);
          guard_to = epilog_e->dest;
          guard_e = slpeel_add_loop_guard (guard_bb, guard_cond, guard_to,
                                           skip_vector ? anchor : guard_bb,
@@ -3626,7 +3626,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
          doms.safe_push (guard_to);
          if (vect_epilogues)
            epilogue_vinfo->skip_this_loop_edge = guard_e;
-         edge main_iv = LOOP_VINFO_IV_EXIT (loop_vinfo);
+         edge main_iv = LOOP_VINFO_MAIN_EXIT (loop_vinfo);
          gphi_iterator gsi2 = gsi_start_phis (main_iv->dest);
          for (gphi_iterator gsi = gsi_start_phis (guard_to);
               !gsi_end_p (gsi); gsi_next (&gsi))
@@ -3741,8 +3741,8 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
     {
       epilog->aux = epilogue_vinfo;
       LOOP_VINFO_LOOP (epilogue_vinfo) = epilog;
-      LOOP_VINFO_IV_EXIT (epilogue_vinfo)
-       = LOOP_VINFO_EPILOGUE_IV_EXIT (loop_vinfo);
+      LOOP_VINFO_MAIN_EXIT (epilogue_vinfo)
+       = LOOP_VINFO_EPILOGUE_MAIN_EXIT (loop_vinfo);
 
       loop_constraint_clear (epilog, LOOP_C_INFINITE);
 
@@ -4378,7 +4378,7 @@ vect_loop_versioning (loop_vec_info loop_vinfo,
        currently using.  */
       edge exit_edge;
       if (loop_to_version == loop)
-       exit_edge = LOOP_VINFO_IV_EXIT (loop_vinfo);
+       exit_edge = LOOP_VINFO_MAIN_EXIT (loop_vinfo);
       else
        exit_edge = single_exit (loop_to_version);
       exit_edge->dest->count = preheader->count;
@@ -4472,7 +4472,7 @@ vect_loop_versioning (loop_vec_info loop_vinfo,
         currently using.  */
       edge exit_edge;
       if (loop_to_version == loop)
-       exit_edge = LOOP_VINFO_IV_EXIT (loop_vinfo);
+       exit_edge = LOOP_VINFO_MAIN_EXIT (loop_vinfo);
       else
        exit_edge = single_exit (loop_to_version);
 
index 3a38732e74634dd885232e2833f7d5e138b8f18a..2b86d4c4ea96519b1dc0608a047d1f049f7abed2 100644 (file)
@@ -657,17 +657,24 @@ vec_init_loop_exit_info (class loop *loop)
   /* Before we begin we must first determine which exit is the main one and
      which are auxilary exits.  */
   auto_vec<edge> exits = get_loop_exit_edges (loop);
+  if (exits.length () == 0)
+    return NULL;
   if (exits.length () == 1)
     return exits[0];
 
-  /* If we have multiple exits we only support counting IV at the moment.
+  /* If we have multiple exits, look for counting IV exit.
      Analyze all exits and return the last one we can analyze.  */
   class tree_niter_desc niter_desc;
   edge candidate = NULL;
   for (edge exit : exits)
     {
       if (!get_loop_exit_condition (exit))
-       continue;
+       {
+         if (dump_enabled_p ())
+           dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+                            "Unhandled loop exit detected.\n");
+         return NULL;
+       }
 
       if (number_of_iterations_exit_assumptions (loop, exit, &niter_desc, NULL)
          && !chrec_contains_undetermined (niter_desc.niter))
@@ -688,6 +695,11 @@ vec_init_loop_exit_info (class loop *loop)
        }
     }
 
+  /* If no exit is analyzable by scalar evolution, we return the last exit
+     under the assummption we are dealing with an uncounted loop.  */
+  if (!candidate && single_pred_p (loop->latch))
+    candidate = loop_exits_from_bb_p (loop, single_pred (loop->latch));
+
   return candidate;
 }
 
@@ -759,9 +771,9 @@ _loop_vec_info::_loop_vec_info (class loop *loop_in, vec_info_shared *shared)
     orig_loop_info (NULL),
     epilogue_vinfo (NULL),
     drs_advanced_by (NULL_TREE),
-    vec_loop_iv_exit (NULL),
-    vec_epilogue_loop_iv_exit (NULL),
-    scalar_loop_iv_exit (NULL)
+    vec_loop_main_exit (NULL),
+    vec_epilogue_loop_main_exit (NULL),
+    scalar_loop_main_exit (NULL)
 {
   /* CHECKME: We want to visit all BBs before their successors (except for
      latch blocks, for which this assertion wouldn't hold).  In the simple
@@ -1430,8 +1442,7 @@ vect_analyze_loop_form (class loop *loop, gimple *loop_vectorized_call,
   if (!exit_e)
     return opt_result::failure_at (vect_location,
                                   "not vectorized:"
-                                  " could not determine main exit from"
-                                  " loop with multiple exits.\n");
+                                  " Infinite loop detected.\n");
   if (loop_vectorized_call)
     {
       tree arg = gimple_call_arg (loop_vectorized_call, 1);
@@ -1660,7 +1671,7 @@ vect_create_loop_vinfo (class loop *loop, vec_info_shared *shared,
   for (; cond_id < info->conds.length (); cond_id ++)
     LOOP_VINFO_LOOP_CONDS (loop_vinfo).safe_push (info->conds[cond_id]);
 
-  LOOP_VINFO_IV_EXIT (loop_vinfo) = info->loop_exit;
+  LOOP_VINFO_MAIN_EXIT (loop_vinfo) = info->loop_exit;
 
   /* Check to see if we're vectorizing multiple exits.  */
   LOOP_VINFO_EARLY_BREAKS (loop_vinfo)
@@ -2481,8 +2492,8 @@ start_over:
         dump_printf_loc (MSG_NOTE, vect_location, "epilog loop required\n");
       if (!vect_can_advance_ivs_p (loop_vinfo)
          || !slpeel_can_duplicate_loop_p (loop,
-                                          LOOP_VINFO_IV_EXIT (loop_vinfo),
-                                          LOOP_VINFO_IV_EXIT (loop_vinfo)))
+                                          LOOP_VINFO_MAIN_EXIT (loop_vinfo),
+                                          LOOP_VINFO_MAIN_EXIT (loop_vinfo)))
         {
          ok = opt_result::failure_at (vect_location,
                                       "not vectorized: can't create required "
@@ -5396,7 +5407,7 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo,
       /* Create an induction variable.  */
       gimple_stmt_iterator incr_gsi;
       bool insert_after;
-      vect_iv_increment_position (LOOP_VINFO_IV_EXIT (loop_vinfo),
+      vect_iv_increment_position (LOOP_VINFO_MAIN_EXIT (loop_vinfo),
                                  &incr_gsi, &insert_after);
       create_iv (series_vect, PLUS_EXPR, vec_step, NULL_TREE, loop, &incr_gsi,
                 insert_after, &indx_before_incr, &indx_after_incr);
@@ -5484,7 +5495,7 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo,
       def = vect_get_slp_vect_def (slp_node, i);
       tree new_def = copy_ssa_name (def);
       phi = create_phi_node (new_def, exit_bb);
-      if (LOOP_VINFO_IV_EXIT (loop_vinfo) == loop_exit)
+      if (LOOP_VINFO_MAIN_EXIT (loop_vinfo) == loop_exit)
        SET_PHI_ARG_DEF (phi, loop_exit->dest_idx, def);
       else
        {
@@ -10112,7 +10123,7 @@ vectorizable_live_operation (vec_info *vinfo, stmt_vec_info stmt_info,
          || !LOOP_VINFO_EARLY_BREAKS_VECT_PEELED (loop_vinfo))
        vect_create_epilog_for_reduction (loop_vinfo, stmt_info, slp_node,
                                          slp_node_instance,
-                                         LOOP_VINFO_IV_EXIT (loop_vinfo));
+                                         LOOP_VINFO_MAIN_EXIT (loop_vinfo));
 
       /* If early break we only have to materialize the reduction on the merge
         block, but we have to find an alternate exit first.  */
@@ -10121,7 +10132,7 @@ vectorizable_live_operation (vec_info *vinfo, stmt_vec_info stmt_info,
          slp_tree phis_node = slp_node_instance->reduc_phis;
          stmt_info = SLP_TREE_REPRESENTATIVE (phis_node);
          for (auto exit : get_loop_exit_edges (LOOP_VINFO_LOOP (loop_vinfo)))
-           if (exit != LOOP_VINFO_IV_EXIT (loop_vinfo))
+           if (exit != LOOP_VINFO_MAIN_EXIT (loop_vinfo))
              {
                vect_create_epilog_for_reduction (loop_vinfo, stmt_info,
                                                  phis_node, slp_node_instance,
@@ -10131,7 +10142,8 @@ vectorizable_live_operation (vec_info *vinfo, stmt_vec_info stmt_info,
          if (LOOP_VINFO_EARLY_BREAKS_VECT_PEELED (loop_vinfo))
            vect_create_epilog_for_reduction (loop_vinfo, stmt_info,
                                              phis_node, slp_node_instance,
-                                             LOOP_VINFO_IV_EXIT (loop_vinfo));
+                                             LOOP_VINFO_MAIN_EXIT
+                                             (loop_vinfo));
        }
 
       return true;
@@ -10270,7 +10282,7 @@ vectorizable_live_operation (vec_info *vinfo, stmt_vec_info stmt_info,
         in these cases for an early break we restart the iteration the vector code
         did.  For the live values we want the value at the start of the iteration
         rather than at the end.  */
-      edge main_e = LOOP_VINFO_IV_EXIT (loop_vinfo);
+      edge main_e = LOOP_VINFO_MAIN_EXIT (loop_vinfo);
       bool all_exits_as_early_p = LOOP_VINFO_EARLY_BREAKS_VECT_PEELED (loop_vinfo);
       FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, lhs)
        if (!is_gimple_debug (use_stmt)
@@ -11022,7 +11034,7 @@ vect_update_ivs_after_vectorizer_for_early_breaks (loop_vec_info loop_vinfo)
       basic_block exit_bb = NULL;
       /* Identify the early exit merge block.  I wish we had stored this.  */
       for (auto e : get_loop_exit_edges (loop))
-       if (e != LOOP_VINFO_IV_EXIT (loop_vinfo))
+       if (e != LOOP_VINFO_MAIN_EXIT (loop_vinfo))
          {
            exit_bb = e->dest;
            break;
@@ -11089,7 +11101,7 @@ vect_transform_loop (loop_vec_info loop_vinfo, gimple *loop_vectorized_call)
 
   /* Make sure there exists a single-predecessor exit bb.  Do this before
      versioning.   */
-  edge e = LOOP_VINFO_IV_EXIT (loop_vinfo);
+  edge e = LOOP_VINFO_MAIN_EXIT (loop_vinfo);
   if (! single_pred_p (e->dest) && !LOOP_VINFO_EARLY_BREAKS (loop_vinfo))
     {
       split_loop_exit_edge (e, true);
@@ -11115,7 +11127,7 @@ vect_transform_loop (loop_vec_info loop_vinfo, gimple *loop_vectorized_call)
      loop closed PHI nodes on the exit.  */
   if (LOOP_VINFO_SCALAR_LOOP (loop_vinfo))
     {
-      e = LOOP_VINFO_SCALAR_IV_EXIT (loop_vinfo);
+      e = LOOP_VINFO_SCALAR_MAIN_EXIT (loop_vinfo);
       if (! single_pred_p (e->dest))
        {
          split_loop_exit_edge (e, true);
@@ -11148,7 +11160,7 @@ vect_transform_loop (loop_vec_info loop_vinfo, gimple *loop_vectorized_call)
              (LOOP_VINFO_SCALAR_LOOP_SCALING (loop_vinfo));
       scale_loop_frequencies (LOOP_VINFO_SCALAR_LOOP (loop_vinfo),
                              LOOP_VINFO_SCALAR_LOOP_SCALING (loop_vinfo));
-      LOOP_VINFO_SCALAR_IV_EXIT (loop_vinfo)->dest->count = preheader->count;
+      LOOP_VINFO_SCALAR_MAIN_EXIT (loop_vinfo)->dest->count = preheader->count;
     }
 
   if (niters_vector == NULL_TREE)
@@ -11281,7 +11293,7 @@ vect_transform_loop (loop_vec_info loop_vinfo, gimple *loop_vectorized_call)
      a zero NITERS becomes a nonzero NITERS_VECTOR.  */
   if (integer_onep (step_vector))
     niters_no_overflow = true;
-  vect_set_loop_condition (loop, LOOP_VINFO_IV_EXIT (loop_vinfo), loop_vinfo,
+  vect_set_loop_condition (loop, LOOP_VINFO_MAIN_EXIT (loop_vinfo), loop_vinfo,
                           niters_vector, step_vector, niters_vector_mult_vf,
                           !niters_no_overflow);
 
@@ -11360,7 +11372,7 @@ vect_transform_loop (loop_vec_info loop_vinfo, gimple *loop_vectorized_call)
                          assumed_vf) - 1
         : wi::udiv_floor (loop->nb_iterations_estimate + bias_for_assumed,
                           assumed_vf) - 1);
-  scale_profile_for_vect_loop (loop, LOOP_VINFO_IV_EXIT (loop_vinfo),
+  scale_profile_for_vect_loop (loop, LOOP_VINFO_MAIN_EXIT (loop_vinfo),
                               assumed_vf, flat);
 
   if (dump_enabled_p ())
index e7a3f26504837ca7e95b5187c8ac4ec226dd7f63..938d9bdc7625b97030493dec8b17adda5bb93bc3 100644 (file)
@@ -965,7 +965,7 @@ set_uid_loop_bbs (loop_vec_info loop_vinfo, gimple *loop_vectorized_call,
   class loop *scalar_loop = get_loop (fun, tree_to_shwi (arg));
 
   LOOP_VINFO_SCALAR_LOOP (loop_vinfo) = scalar_loop;
-  LOOP_VINFO_SCALAR_IV_EXIT (loop_vinfo)
+  LOOP_VINFO_SCALAR_MAIN_EXIT (loop_vinfo)
     = vec_init_loop_exit_info (scalar_loop);
   gcc_checking_assert (vect_loop_vectorized_call (scalar_loop)
                       == loop_vectorized_call);
index c9dee90c4701c295eee227fa3115052ca076cb76..b5cb835a82be3cfc59828a3b832427c432c93033 100644 (file)
@@ -1219,17 +1219,17 @@ public:
   /* If this is an epilogue loop the DR advancement applied.  */
   tree drs_advanced_by;
 
-  /* The controlling loop IV for the current loop when vectorizing.  This IV
-     controls the natural exits of the loop.  */
-  edge vec_loop_iv_exit;
+  /* The controlling loop exit for the current loop when vectorizing.
+     For counted loops, this IV controls the natural exits of the loop.  */
+  edge vec_loop_main_exit;
 
-  /* The controlling loop IV for the epilogue loop when vectorizing.  This IV
-     controls the natural exits of the loop.  */
-  edge vec_epilogue_loop_iv_exit;
+  /* The controlling loop exit for the epilogue loop when vectorizing.
+     For counted loops, this IV controls the natural exits of the loop.  */
+  edge vec_epilogue_loop_main_exit;
 
-  /* The controlling loop IV for the scalar loop being vectorized.  This IV
-     controls the natural exits of the loop.  */
-  edge scalar_loop_iv_exit;
+  /* The controlling loop exit for the scalar loop being vectorized.
+     For counted loops, this IV controls the natural exits of the loop.  */
+  edge scalar_loop_main_exit;
 
   /* Used to store the list of stores needing to be moved if doing early
      break vectorization as they would violate the scalar loop semantics if
@@ -1256,9 +1256,9 @@ public:
 
 /* Access Functions.  */
 #define LOOP_VINFO_LOOP(L)                 (L)->loop
-#define LOOP_VINFO_IV_EXIT(L)              (L)->vec_loop_iv_exit
-#define LOOP_VINFO_EPILOGUE_IV_EXIT(L)     (L)->vec_epilogue_loop_iv_exit
-#define LOOP_VINFO_SCALAR_IV_EXIT(L)       (L)->scalar_loop_iv_exit
+#define LOOP_VINFO_MAIN_EXIT(L)              (L)->vec_loop_main_exit
+#define LOOP_VINFO_EPILOGUE_MAIN_EXIT(L)     (L)->vec_epilogue_loop_main_exit
+#define LOOP_VINFO_SCALAR_MAIN_EXIT(L)       (L)->scalar_loop_main_exit
 #define LOOP_VINFO_BBS(L)                  (L)->bbs
 #define LOOP_VINFO_NBBS(L)                 (L)->nbbs
 #define LOOP_VINFO_NITERSM1(L)             (L)->num_itersm1
@@ -1313,7 +1313,7 @@ public:
 #define LOOP_VINFO_EARLY_BREAKS(L)         (L)->early_breaks
 #define LOOP_VINFO_EARLY_BRK_STORES(L)     (L)->early_break_stores
 #define LOOP_VINFO_EARLY_BREAKS_VECT_PEELED(L)  \
-  ((single_pred ((L)->loop->latch) != (L)->vec_loop_iv_exit->src) \
+  ((single_pred ((L)->loop->latch) != (L)->vec_loop_main_exit->src) \
    || LOOP_VINFO_NITERS_UNCOUNTED_P (L))
 #define LOOP_VINFO_EARLY_BREAKS_LIVE_IVS(L)  \
   (L)->early_break_live_ivs