aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2023-03-21 12:49:36 +0100
committerRichard Biener <rguenther@suse.de>2023-03-21 14:04:31 +0100
commit26adc870e3675591050f37edab46850b97a3c122 (patch)
treea7a7c40e519ea641bd28274957522e931b3ab36a
parent49a8bce43cdc1d1b48efa5eeb2a4097cfca1dc22 (diff)
downloadgcc-26adc870e3675591050f37edab46850b97a3c122.zip
gcc-26adc870e3675591050f37edab46850b97a3c122.tar.gz
gcc-26adc870e3675591050f37edab46850b97a3c122.tar.bz2
tree-optimization/109219 - avoid looking at STMT_SLP_TYPE
The following avoids looking at STMT_SLP_TYPE apart from the only place needing it - transform and analysis of non-SLP loop stmts. In particular it doesn't have a reliable meaning on SLP representatives which are also passed as stmt_vinfo to vectorizable_* routines. The proper way to check in those is to look for the slp_node argument instead. PR tree-optimization/109219 * tree-vect-loop.cc (vectorizable_reduction): Check slp_node, not STMT_SLP_TYPE. * tree-vect-stmts.cc (vectorizable_condition): Likewise. * tree-vect-slp.cc (vect_slp_analyze_node_operations_1): Remove assertion on STMT_SLP_TYPE. * gcc.dg/torture/pr109219.c: New testcase.
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr109219.c21
-rw-r--r--gcc/tree-vect-loop.cc2
-rw-r--r--gcc/tree-vect-slp.cc2
-rw-r--r--gcc/tree-vect-stmts.cc2
4 files changed, 23 insertions, 4 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/pr109219.c b/gcc/testsuite/gcc.dg/torture/pr109219.c
new file mode 100644
index 0000000..2b5c514a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr109219.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-ftree-vectorize" } */
+
+int safe_lshift_func_int32_t_s_s_left, safe_lshift_func_int32_t_s_s_right,
+ safe_sub_func_uint64_t_u_u_ui2, safe_mul_func_uint64_t_u_u_ui2, g_79_2,
+ g_97_l_439;
+void g_97(int * __restrict l_437)
+{
+ for (; g_97_l_439; g_97_l_439 += 1)
+ for (char l_502 = 0; l_502 < 4; l_502++)
+ {
+ int __trans_tmp_14 = ((safe_lshift_func_int32_t_s_s_right >= 2
+ || safe_lshift_func_int32_t_s_s_left)
+ ? 1 : safe_lshift_func_int32_t_s_s_right);
+ long __trans_tmp_15 = __trans_tmp_14 * safe_mul_func_uint64_t_u_u_ui2;
+ unsigned short __trans_tmp_16 = -__trans_tmp_15;
+ int __trans_tmp_7
+ = (__trans_tmp_16 ^ 65535UL) - safe_sub_func_uint64_t_u_u_ui2;
+ *l_437 ^= (short)(__trans_tmp_7 ^ g_79_2);
+ }
+}
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 320c15f..1ba9f18 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -7424,7 +7424,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo,
}
/* Check extra constraints for variable-length unchained SLP reductions. */
- if (STMT_SLP_TYPE (stmt_info)
+ if (slp_node
&& !REDUC_GROUP_FIRST_ELEMENT (stmt_info)
&& !nunits_out.is_constant ())
{
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 9a4e000..356bdfb 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -5951,8 +5951,6 @@ vect_slp_analyze_node_operations_1 (vec_info *vinfo, slp_tree node,
return true;
}
- gcc_assert (STMT_SLP_TYPE (stmt_info) != loop_vect);
-
bool dummy;
return vect_analyze_stmt (vinfo, stmt_info, &dummy,
node, node_instance, cost_vec);
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index f5e7561..efa2d0d 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -10510,7 +10510,7 @@ vectorizable_condition (vec_info *vinfo,
= STMT_VINFO_REDUC_DEF (vect_orig_stmt (stmt_info)) != NULL;
if (for_reduction)
{
- if (STMT_SLP_TYPE (stmt_info))
+ if (slp_node)
return false;
reduc_info = info_for_reduction (vinfo, stmt_info);
reduction_type = STMT_VINFO_REDUC_TYPE (reduc_info);