From: Richard Biener Date: Thu, 23 Oct 2025 09:05:45 +0000 (+0200) Subject: Move SLP permute optimization until after VF is final X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6682f495f43847941cc99d5cf1f19c2eb47497ed;p=thirdparty%2Fgcc.git 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 --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index bc01e12f05b..d44a77d85c3 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,