]> git.ipfire.org Git - thirdparty/gcc.git/commit
vect: Fix uncounted PHI handling of `slpeel_tree_duplicate_loop_to_edge_cfg'
authorVictor Do Nascimento <victor.donascimento@arm.com>
Mon, 27 Oct 2025 13:48:09 +0000 (13:48 +0000)
committerVictor Do Nascimento <victor.donascimento@arm.com>
Mon, 15 Dec 2025 15:27:02 +0000 (15:27 +0000)
commit2c9ddd6687b0366e2a0b7e0a5d0b205d31dbb77a
treee9b6a984a4679daccc650a0e5acb55be5fabeebc
parentf45546d344596051ac8541a61902da01a090e646
vect: Fix uncounted PHI handling of `slpeel_tree_duplicate_loop_to_edge_cfg'

Given how present requirements for loops, early-break or otherwise, to
have a known iteration count, there is currently no need for
single-exit loops to reset induction variables and accumulators prior
to entering the exit loop.

For multiple-exit uncounted loops, there are provisions in the code
for resetting IVs and accumulators on exiting the loop via early
exits.  This is extended to the main exit (though only in
multiple-exit loops) if `peeled_iters' is set to `true', wherein the
definition of `peeled_iters' is equivalent to that of
LOOP_VINFO_EARLY_BREAKS_VECT_PEELED, but is evaluated independently as
the function does not have access to loop_vinfo.

Therefore, the first fix is to ensure that, just as for
LOOP_VINFO_EARLY_BREAKS_VECT_PEELED, `peeled_iters' also evaluates to
true for uncounted loops.

The second fix implemented here is: given the relevant logic is
currently hidden behind the `multiple_exits_p', we enable relevant
logic via use of the new function argument `uncounted_p'.

gcc/ChangeLog:

* tree-vect-loop-manip.cc (slpeel_tree_duplicate_loop_to_edge_cfg):
reset IVs and accumulators for all exits for uncounted loops.
* tree-vectorizer.h (slpeel_tree_duplicate_loop_to_edge_cfg):
add boolean `uncounted_p' argument.
gcc/tree-vect-loop-manip.cc
gcc/tree-vectorizer.h