From: Richard Biener Date: Wed, 3 Jun 2020 11:17:11 +0000 (+0200) Subject: simplify visited flag unsetting in SLP scalar cost computation X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f05c84ac139ccd5398542369aad2b5ff3059ced4;p=gcc.git simplify visited flag unsetting in SLP scalar cost computation This changes the loop over all stmts to a loop over all costed stmts. 2020-06-03 Richard Biener * tree-vect-slp.c (vect_bb_vectorization_profitable_p): Loop over the cost vector to unset the visited flag on stmts. --- diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 836defce990..f1d61944ae0 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -3078,6 +3078,11 @@ vect_bb_vectorization_profitable_p (bb_vec_info bb_vinfo) SLP_INSTANCE_TREE (instance), &life, &scalar_costs, visited); } + /* Unset visited flag. */ + stmt_info_for_cost *si; + FOR_EACH_VEC_ELT (scalar_costs, i, si) + gimple_set_visited (si->stmt_info->stmt, false); + void *target_cost_data = init_cost (NULL); add_stmt_costs (bb_vinfo, target_cost_data, &scalar_costs); scalar_costs.release (); @@ -3085,11 +3090,6 @@ vect_bb_vectorization_profitable_p (bb_vec_info bb_vinfo) finish_cost (target_cost_data, &dummy, &scalar_cost, &dummy); destroy_cost_data (target_cost_data); - /* Unset visited flag. */ - for (gimple_stmt_iterator gsi = bb_vinfo->region_begin; - gsi_stmt (gsi) != gsi_stmt (bb_vinfo->region_end); gsi_next (&gsi)) - gimple_set_visited (gsi_stmt (gsi), false); - /* Complete the target-specific cost calculation. */ finish_cost (BB_VINFO_TARGET_COST_DATA (bb_vinfo), &vec_prologue_cost, &vec_inside_cost, &vec_epilogue_cost);