aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2024-11-13 14:43:27 +0100
committerRichard Biener <rguenth@gcc.gnu.org>2024-11-14 09:06:16 +0100
commit4b4aa47ed296968507b2fde70d2e651129ff3b36 (patch)
tree658c698467e4ebc22ae925a40b0b20a25191b494 /gcc
parent735f5260fb42919a651ed8e381c9e1a11e753345 (diff)
downloadgcc-4b4aa47ed296968507b2fde70d2e651129ff3b36.zip
gcc-4b4aa47ed296968507b2fde70d2e651129ff3b36.tar.gz
gcc-4b4aa47ed296968507b2fde70d2e651129ff3b36.tar.bz2
tree-optimization/117556 - SLP of live stmts from load-lanes
The following fixes SLP live lane generation for load-lanes which fails to analyze for gcc.dg/vect/vect-live-slp-3.c because the VLA division doesn't work out but it would also wrongly use the transposed vector defs I think. The following properly disables the actual load-lanes SLP node from live lane processing and instead relies on the SLP permute node representing the live lane where we can use extract-last to extract the last lane. This also fixes the reported Ada miscompile. PR tree-optimization/117556 PR tree-optimization/117553 * tree-vect-stmts.cc (vect_analyze_stmt): Do not analyze the SLP load-lanes node for live lanes, but only the permute node. (vect_transform_stmt): Likewise for the transform. * gcc.dg/vect/vect-live-slp-3.c: Expect us to SLP even for VLA vectors (in single-lane mode).
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-live-slp-3.c2
-rw-r--r--gcc/tree-vect-stmts.cc6
2 files changed, 6 insertions, 2 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/vect-live-slp-3.c b/gcc/testsuite/gcc.dg/vect/vect-live-slp-3.c
index e378224..3caeea7 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-live-slp-3.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-live-slp-3.c
@@ -73,5 +73,5 @@ main (void)
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 4 "vect" } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { xfail vect_variable_length } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" } } */
/* { dg-final { scan-tree-dump-times "vec_stmt_relevant_p: stmt live but not relevant" 4 "vect" } } */
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index f77a223..2b3dd52 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -13594,6 +13594,7 @@ vect_analyze_stmt (vec_info *vinfo,
if (!bb_vinfo
&& STMT_VINFO_TYPE (stmt_info) != reduc_vec_info_type
&& STMT_VINFO_TYPE (stmt_info) != lc_phi_info_type
+ && (!node || !node->ldst_lanes || SLP_TREE_CODE (node) == VEC_PERM_EXPR)
&& !can_vectorize_live_stmts (as_a <loop_vec_info> (vinfo),
stmt_info, node, node_instance,
false, cost_vec))
@@ -13756,7 +13757,10 @@ vect_transform_stmt (vec_info *vinfo,
if (!slp_node && vec_stmt)
gcc_assert (STMT_VINFO_VEC_STMTS (stmt_info).exists ());
- if (STMT_VINFO_TYPE (stmt_info) != store_vec_info_type)
+ if (STMT_VINFO_TYPE (stmt_info) != store_vec_info_type
+ && (!slp_node
+ || !slp_node->ldst_lanes
+ || SLP_TREE_CODE (slp_node) == VEC_PERM_EXPR))
{
/* Handle stmts whose DEF is used outside the loop-nest that is
being vectorized. */