]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
middle-end: remove more usages of single_exit
authorTamar Christina <tamar.christina@arm.com>
Fri, 12 Jan 2024 15:27:01 +0000 (15:27 +0000)
committerTamar Christina <tamar.christina@arm.com>
Fri, 12 Jan 2024 15:32:19 +0000 (15:32 +0000)
This replaces two more usages of single_exit that I had missed before.
They both seem to happen when we re-use the ifcvt scalar loop for versioning.

The condition in versioning is the same as the one for when we don't re-use the
scalar loop.

gcc/ChangeLog:

* tree-vect-loop-manip.cc (vect_loop_versioning): Replace single_exit.
* tree-vect-loop.cc (vect_transform_loop): Likewise.

gcc/tree-vect-loop-manip.cc
gcc/tree-vect-loop.cc

index 2a1f9cd77071dd63384c76c8bad28215bf2a9cdf..1d6e5e045c38d36313c726c76109e5f28fc68a72 100644 (file)
@@ -4066,7 +4066,16 @@ vect_loop_versioning (loop_vec_info loop_vinfo,
       basic_block preheader = loop_preheader_edge (loop_to_version)->src;
       preheader->count = preheader->count.apply_probability (prob * prob2);
       scale_loop_frequencies (loop_to_version, prob * prob2);
-      single_exit (loop_to_version)->dest->count = preheader->count;
+      /* When the loop has multiple exits then we can only version itself.
+       This is denoted by loop_to_version == loop.  In this case we can
+       do the versioning by selecting the exit edge the vectorizer is
+       currently using.  */
+      edge exit_edge;
+      if (loop_to_version == loop)
+       exit_edge = LOOP_VINFO_IV_EXIT (loop_vinfo);
+      else
+       exit_edge = single_exit (loop_to_version);
+      exit_edge->dest->count = preheader->count;
       LOOP_VINFO_SCALAR_LOOP_SCALING (loop_vinfo) = (prob * prob2).invert ();
 
       nloop = scalar_loop;
index 44022bf94480988bdb370d85924fc0d142963b2d..fedecd620e9b2f035f5b9565cdb49ccd5aca7724 100644 (file)
@@ -11943,8 +11943,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));
-      single_exit (LOOP_VINFO_SCALAR_LOOP (loop_vinfo))->dest->count
-       = preheader->count;
+      LOOP_VINFO_SCALAR_IV_EXIT (loop_vinfo)->dest->count = preheader->count;
     }
 
   if (niters_vector == NULL_TREE)