When vectorizing counted loops with early breaks, the main loop
exit is distinct from the early-break exits. The latter share
a common merge block, which is identified by examining the loop
exit edges and excluding `LOOP_VINFO_MAIN_EXIT'.
For uncounted loops, however, there is no separate iteration-counting
exit. The main exit is itself an early-break exit, and all loop
exits lead to the same early-exit merge block.
Allow `LOOP_VINFO_MAIN_EXIT' to be considered when identifying the
early-exit merge block for uncounted loops.
gcc/ChangeLog:
* tree-vect-loop.cc
(vect_update_ivs_after_vectorizer_for_early_breaks): Include
the main exit when identifying the early-exit merge block
for uncounted loops.
---
gcc/tree-vect-loop.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 779318a7b99..955fb7414ef 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -11397,7 +11397,8 @@ 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_MAIN_EXIT (loop_vinfo))
+ if (LOOP_VINFO_NITERS_UNCOUNTED_P (loop_vinfo)
+ || e != LOOP_VINFO_MAIN_EXIT (loop_vinfo))
{
exit_bb = e->dest;
break;
--
2.43.0