public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/tnfchris/heads/gcc-14-early-break)] middle-end: support multiple exits in loop versioning
@ 2023-11-15 14:55 Tamar Christina
0 siblings, 0 replies; only message in thread
From: Tamar Christina @ 2023-11-15 14:55 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:249a10e231eb5ebed38536a75d9e90259a687061
commit 249a10e231eb5ebed38536a75d9e90259a687061
Author: Tamar Christina <tamar.christina@arm.com>
Date: Thu Nov 2 15:42:21 2023 +0000
middle-end: support multiple exits in loop versioning
Reviewed at https://reviewboard.gnu.aws.arm.com/r/17966/
Diff:
---
gcc/tree-vect-loop-manip.cc | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
index a5a612dc6b4..d3fa8699271 100644
--- a/gcc/tree-vect-loop-manip.cc
+++ b/gcc/tree-vect-loop-manip.cc
@@ -4016,12 +4016,23 @@ vect_loop_versioning (loop_vec_info loop_vinfo,
If loop versioning wasn't done from loop, but scalar_loop instead,
merge_bb will have already just a single successor. */
- merge_bb = single_exit (loop_to_version)->dest;
+ /* 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);
+
+ gcc_assert (exit_edge);
+ merge_bb = exit_edge->dest;
if (EDGE_COUNT (merge_bb->preds) >= 2)
{
gcc_assert (EDGE_COUNT (merge_bb->preds) >= 2);
- new_exit_bb = split_edge (single_exit (loop_to_version));
- new_exit_e = single_exit (loop_to_version);
+ new_exit_bb = split_edge (exit_edge);
+ new_exit_e = exit_edge;
e = EDGE_SUCC (new_exit_bb, 0);
for (gsi = gsi_start_phis (merge_bb); !gsi_end_p (gsi);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-11-15 14:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-15 14:55 [gcc(refs/users/tnfchris/heads/gcc-14-early-break)] middle-end: support multiple exits in loop versioning Tamar Christina
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).