aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2024-10-15 09:22:09 +0200
committerRichard Biener <rguenth@gcc.gnu.org>2024-10-15 11:06:30 +0200
commit8af474aa5d5efdda7def6cdcec3f246df2c7026a (patch)
treeb7351705a2d61adb3490854f311de777464f139a
parentfa90febea9801d4255bf6a1e9f0fd998629c3c7c (diff)
downloadgcc-8af474aa5d5efdda7def6cdcec3f246df2c7026a.zip
gcc-8af474aa5d5efdda7def6cdcec3f246df2c7026a.tar.gz
gcc-8af474aa5d5efdda7def6cdcec3f246df2c7026a.tar.bz2
tree-optimization/117147 - bogus re-use of previous ldst_p
The following shows that in vect_build_slp_tree_1 we're eventually re-using the previous lane set ldst_p flag. Fixed by some refactoring. PR tree-optimization/117147 * tree-vect-slp.cc (vect_build_slp_tree_1): Put vars and initialization of per-lane data into the per-lane processing loop to avoid re-using previous lane state.
-rw-r--r--gcc/tree-vect-slp.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 16332e0..8727246 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -1072,14 +1072,13 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
stmt_vec_info first_stmt_info = stmts[0];
code_helper first_stmt_code = ERROR_MARK;
code_helper alt_stmt_code = ERROR_MARK;
- code_helper rhs_code = ERROR_MARK;
code_helper first_cond_code = ERROR_MARK;
tree lhs;
bool need_same_oprnds = false;
- tree vectype = NULL_TREE, first_op1 = NULL_TREE;
+ tree first_op1 = NULL_TREE;
stmt_vec_info first_load = NULL, prev_first_load = NULL;
- bool first_stmt_ldst_p = false, ldst_p = false;
- bool first_stmt_phi_p = false, phi_p = false;
+ bool first_stmt_ldst_p = false;
+ bool first_stmt_phi_p = false;
int first_reduc_idx = -1;
bool maybe_soft_fail = false;
tree soft_fail_nunits_vectype = NULL_TREE;
@@ -1088,6 +1087,10 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
stmt_vec_info stmt_info;
FOR_EACH_VEC_ELT (stmts, i, stmt_info)
{
+ bool ldst_p = false;
+ bool phi_p = false;
+ code_helper rhs_code = ERROR_MARK;
+
swap[i] = 0;
matches[i] = false;
if (!stmt_info)
@@ -1139,7 +1142,7 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
return false;
}
- tree nunits_vectype;
+ tree vectype, nunits_vectype;
if (!vect_get_vector_types_for_stmt (vinfo, stmt_info, &vectype,
&nunits_vectype, group_size))
{