https://gcc.gnu.org/g:6682f495f43847941cc99d5cf1f19c2eb47497ed
commit r16-4572-g6682f495f43847941cc99d5cf1f19c2eb47497ed Author: Richard Biener <[email protected]> Date: Thu Oct 23 11:05:45 2025 +0200 Move SLP permute optimization until after VF is final The following moves SLP permute optimization until after we applied a possible extra unroll factor. * tree-vect-loop.cc (vect_analyze_loop_2): Move vect_optimize_slp after applying suggested_unroll_factor. Diff: --- gcc/tree-vect-loop.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index bc01e12f05bc..d44a77d85c3f 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -2253,12 +2253,6 @@ start_over: dump_printf (MSG_NOTE, "\n"); } - /* Optimize the SLP graph with the vectorization factor fixed. */ - vect_optimize_slp (loop_vinfo); - - /* Gather the loads reachable from the SLP graph entries. */ - vect_gather_slp_loads (loop_vinfo); - /* We don't expect to have to roll back to anything other than an empty set of rgroups. */ gcc_assert (LOOP_VINFO_MASKS (loop_vinfo).is_empty ()); @@ -2273,6 +2267,12 @@ start_over: poly_uint64 vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_vinfo); gcc_assert (known_ne (vectorization_factor, 0U)); + /* Optimize the SLP graph with the vectorization factor fixed. */ + vect_optimize_slp (loop_vinfo); + + /* Gather the loads reachable from the SLP graph entries. */ + vect_gather_slp_loads (loop_vinfo); + if (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo) && dump_enabled_p ()) { dump_printf_loc (MSG_NOTE, vect_location,
