From: Richard Biener Date: Wed, 2 Dec 2020 10:07:43 +0000 (+0100) Subject: guard maybe_set_vectorized_backedge_value calls X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a35d5e93654d4947f116f77ff0ed6ab2672d1df2;p=gcc.git guard maybe_set_vectorized_backedge_value calls This makes sure to not call maybe_set_vectorized_backedge_value when we did not vectorize the latch def candidate. 2020-12-02 Richard Biener * tree-vect-loop.c (vect_transform_loop_stmt): Return whether we vectorized a stmt. (vect_transform_loop): Only call maybe_set_vectorized_backedge_value when we vectorized the stmt. --- diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index c8b4dc3a0c3..72bbec4b45d 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -9081,7 +9081,7 @@ maybe_set_vectorized_backedge_value (loop_vec_info loop_vinfo, When vectorizing STMT_INFO as a store, set *SEEN_STORE to its stmt_vec_info. */ -static void +static bool vect_transform_loop_stmt (loop_vec_info loop_vinfo, stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, stmt_vec_info *seen_store) { @@ -9097,7 +9097,7 @@ vect_transform_loop_stmt (loop_vec_info loop_vinfo, stmt_vec_info stmt_info, if (!STMT_VINFO_RELEVANT_P (stmt_info) && !STMT_VINFO_LIVE_P (stmt_info)) - return; + return false; if (STMT_VINFO_VECTYPE (stmt_info)) { @@ -9114,13 +9114,15 @@ vect_transform_loop_stmt (loop_vec_info loop_vinfo, stmt_vec_info stmt_info, /* Pure SLP statements have already been vectorized. We still need to apply loop vectorization to hybrid SLP statements. */ if (PURE_SLP_STMT (stmt_info)) - return; + return false; if (dump_enabled_p ()) dump_printf_loc (MSG_NOTE, vect_location, "transform statement.\n"); if (vect_transform_stmt (loop_vinfo, stmt_info, gsi, NULL, NULL)) *seen_store = stmt_info; + + return true; } /* Helper function to pass to simplify_replace_tree to enable replacing tree's @@ -9546,17 +9548,17 @@ vect_transform_loop (loop_vec_info loop_vinfo, gimple *loop_vectorized_call) } stmt_vec_info pat_stmt_info = STMT_VINFO_RELATED_STMT (stmt_info); - vect_transform_loop_stmt (loop_vinfo, pat_stmt_info, &si, - &seen_store); - maybe_set_vectorized_backedge_value (loop_vinfo, - pat_stmt_info); + if (vect_transform_loop_stmt (loop_vinfo, pat_stmt_info, + &si, &seen_store)) + maybe_set_vectorized_backedge_value (loop_vinfo, + pat_stmt_info); } else { - vect_transform_loop_stmt (loop_vinfo, stmt_info, &si, - &seen_store); - maybe_set_vectorized_backedge_value (loop_vinfo, - stmt_info); + if (vect_transform_loop_stmt (loop_vinfo, stmt_info, &si, + &seen_store)) + maybe_set_vectorized_backedge_value (loop_vinfo, + stmt_info); } } gsi_next (&si);