public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-4865] tree-optimization/111915 - mixing grouped and non-grouped accesses
@ 2023-10-23 13:33 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-10-23 13:33 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:00eb0812e6464307f9f971d2a743d720015e70cf

commit r14-4865-g00eb0812e6464307f9f971d2a743d720015e70cf
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Oct 23 13:42:53 2023 +0200

    tree-optimization/111915 - mixing grouped and non-grouped accesses
    
    The change to allow SLP of non-grouped accesses failed to check
    for the case of mixing with grouped accesses.
    
            PR tree-optimization/111915
            * tree-vect-slp.cc (vect_build_slp_tree_1): Check all
            accesses are either grouped or not.
    
            * gcc.dg/vect/pr111915.c: New testcase.

Diff:
---
 gcc/testsuite/gcc.dg/vect/pr111915.c | 12 ++++++++++++
 gcc/tree-vect-slp.cc                 |  3 +++
 2 files changed, 15 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/vect/pr111915.c b/gcc/testsuite/gcc.dg/vect/pr111915.c
new file mode 100644
index 000000000000..8614bac519c6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr111915.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fno-tree-vrp -fno-tree-dominator-opts -fno-tree-ccp" } */
+
+void
+foo (int * __restrict a, int * __restrict b, int * __restrict w)
+{
+  for (int i = 0; i < 16; ++i)
+    {
+      *a += w[2*i+0];
+      *b += w[2*i&1];
+    }
+}
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 24bf6582f8df..5eb310eceaf8 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -1297,6 +1297,9 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
 			|| rhs_code == INDIRECT_REF
 			|| rhs_code == COMPONENT_REF
 			|| rhs_code == MEM_REF)))
+	      || (ldst_p
+		  && (STMT_VINFO_GROUPED_ACCESS (stmt_info)
+		      != STMT_VINFO_GROUPED_ACCESS (first_stmt_info)))
 	      || (ldst_p
 		  && (STMT_VINFO_GATHER_SCATTER_P (stmt_info)
 		      != STMT_VINFO_GATHER_SCATTER_P (first_stmt_info)))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-10-23 13:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-23 13:33 [gcc r14-4865] tree-optimization/111915 - mixing grouped and non-grouped accesses Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).