From: Richard Biener Date: Mon, 2 Mar 2026 14:10:14 +0000 (+0100) Subject: Move BB analysis code to make flow more obvious X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6ef45ba65b3b19d8ae53d04bbfc1eef9cee141cc;p=thirdparty%2Fgcc.git Move BB analysis code to make flow more obvious The following moves BB vect live stmt marking out of vect_slp_analyze_operations to vect_slp_analyze_bb_1 and SLP stmt marking, marking some vectorized stmts as PURE_SLP, right before it which is the only remaining consumer. * tree-vect-slp.cc (vect_slp_analyze_operations): Move vect_bb_slp_mark_live_stmts call ... (vect_slp_analyze_bb_1): ... here. Move SLP stmt marking right before it. (vect_mark_slp_stmts): Remove unused overload. --- diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index b384bf794c6..08bbc7f0c2e 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -3482,13 +3482,6 @@ vect_mark_slp_stmts (vec_info *vinfo, slp_tree node, vect_mark_slp_stmts (vinfo, child, visited); } -static void -vect_mark_slp_stmts (vec_info *vinfo, slp_tree node) -{ - hash_set visited; - vect_mark_slp_stmts (vinfo, node, visited); -} - /* Mark the statements of the tree rooted at NODE as relevant (vect_used). */ static void @@ -9331,10 +9324,6 @@ vect_slp_analyze_operations (vec_info *vinfo) ++i; } - /* Compute vectorizable live stmts. */ - if (bb_vec_info bb_vinfo = dyn_cast (vinfo)) - vect_bb_slp_mark_live_stmts (bb_vinfo); - return !vinfo->slp_instances.is_empty (); } @@ -10271,15 +10260,8 @@ vect_slp_analyze_bb_1 (bb_vec_info bb_vinfo, int n_stmts, bool &fatal, continue; } - /* Mark all the statements that we want to vectorize as pure SLP and - relevant. */ - vect_mark_slp_stmts (bb_vinfo, SLP_INSTANCE_TREE (instance)); + /* Mark all the statements that we want to vectorize as relevant. */ vect_mark_slp_stmts_relevant (SLP_INSTANCE_TREE (instance)); - unsigned j; - stmt_vec_info root; - /* Likewise consider instance root stmts as vectorized. */ - FOR_EACH_VEC_ELT (SLP_INSTANCE_ROOT_STMTS (instance), j, root) - STMT_SLP_TYPE (root) = pure_slp; i++; } @@ -10294,6 +10276,21 @@ vect_slp_analyze_bb_1 (bb_vec_info bb_vinfo, int n_stmts, bool &fatal, return false; } + /* Mark all the statements that we want to vectorize as pure SLP. */ + hash_set visited; + for (auto instance : BB_VINFO_SLP_INSTANCES (bb_vinfo)) + { + vect_mark_slp_stmts (bb_vinfo, SLP_INSTANCE_TREE (instance), visited); + unsigned j; + stmt_vec_info root; + /* Likewise consider instance root stmts as vectorized. */ + FOR_EACH_VEC_ELT (SLP_INSTANCE_ROOT_STMTS (instance), j, root) + STMT_SLP_TYPE (root) = pure_slp; + } + + /* Compute vectorizable live stmts. */ + vect_bb_slp_mark_live_stmts (bb_vinfo); + vect_bb_partition_graph (bb_vinfo); return true;