aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTamar Christina <tamar.christina@arm.com>2024-01-12 15:27:01 +0000
committerTamar Christina <tamar.christina@arm.com>2024-01-12 15:32:19 +0000
commita8dbae45926db1ebc94c0cc32647c3a45ca62eef (patch)
treee70331f68d639e91c80bc502194ebb596b2d189f /gcc
parente79c5855ab39d96baa7c6bec63eb97715abcf68d (diff)
downloadgcc-a8dbae45926db1ebc94c0cc32647c3a45ca62eef.zip
gcc-a8dbae45926db1ebc94c0cc32647c3a45ca62eef.tar.gz
gcc-a8dbae45926db1ebc94c0cc32647c3a45ca62eef.tar.bz2
middle-end: remove more usages of single_exit
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/tree-vect-loop-manip.cc11
-rw-r--r--gcc/tree-vect-loop.cc3
2 files changed, 11 insertions, 3 deletions
diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
index 2a1f9cd..1d6e5e0 100644
--- a/gcc/tree-vect-loop-manip.cc
+++ b/gcc/tree-vect-loop-manip.cc
@@ -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;
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 44022bf..fedecd6 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -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)