diff options
author | Richard Biener <rguenther@suse.de> | 2025-04-29 14:52:27 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2025-06-06 09:47:45 +0200 |
commit | 6bb316973249d460f4dae2c33a0aa5bc2928ef30 (patch) | |
tree | c099c83c2c322b7190d26975dcb00494b2bf613b | |
parent | e93f02828faf7dc0df6a4d67b1b6b2a30bd713cb (diff) | |
download | gcc-6bb316973249d460f4dae2c33a0aa5bc2928ef30.zip gcc-6bb316973249d460f4dae2c33a0aa5bc2928ef30.tar.gz gcc-6bb316973249d460f4dae2c33a0aa5bc2928ef30.tar.bz2 |
tree-optimization/119960 - fix and guard get_later_stmt
The following makes get_later_stmt handle stmts from different
basic-blocks in the case they are orderd and otherwise asserts.
* tree-vectorizer.h (get_later_stmt): Robustify against
stmts in different BBs, assert when they are unordered.
(cherry picked from commit a6cfde60d8c744b31b147022e797bbcc371ae092)
-rw-r--r-- | gcc/tree-vectorizer.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 01d19c7..94cbfde6 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -1870,11 +1870,25 @@ vect_orig_stmt (stmt_vec_info stmt_info) inline stmt_vec_info get_later_stmt (stmt_vec_info stmt1_info, stmt_vec_info stmt2_info) { - if (gimple_uid (vect_orig_stmt (stmt1_info)->stmt) - > gimple_uid (vect_orig_stmt (stmt2_info)->stmt)) + gimple *stmt1 = vect_orig_stmt (stmt1_info)->stmt; + gimple *stmt2 = vect_orig_stmt (stmt2_info)->stmt; + if (gimple_bb (stmt1) == gimple_bb (stmt2)) + { + if (gimple_uid (stmt1) > gimple_uid (stmt2)) + return stmt1_info; + else + return stmt2_info; + } + /* ??? We should be really calling this function only with stmts + in the same BB but we can recover if there's a domination + relationship between them. */ + else if (dominated_by_p (CDI_DOMINATORS, + gimple_bb (stmt1), gimple_bb (stmt2))) return stmt1_info; - else + else if (dominated_by_p (CDI_DOMINATORS, + gimple_bb (stmt2), gimple_bb (stmt1))) return stmt2_info; + gcc_unreachable (); } /* If STMT_INFO has been replaced by a pattern statement, return the |