diff mbox

Fix PR77621

Message ID alpine.LSU.2.11.1609210926230.26629@t29.fhfr.qr
State New
Headers show

Commit Message

Richard Biener Sept. 21, 2016, 7:27 a.m. UTC
This is the vectorizer part of the fix - it makes sure to split load/store
groups at stmts that have been marked as not vectorizable.

Bootstrapped and tested on x86_64-unknown-linux-gnu.

Richard.

2016-09-21  Richard Biener  <rguenther@suse.de>
	Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/77621
	* tree-vect-data-refs.c (vect_analyze_data_ref_accesses): Split
	group at non-vectorizable stmts.

	* gcc.dg/pr77621.c: New testcase.
diff mbox

Patch

Index: gcc/tree-vect-data-refs.c
===================================================================
--- gcc/tree-vect-data-refs.c	(revision 240255)
+++ gcc/tree-vect-data-refs.c	(working copy)
@@ -2711,10 +2737,17 @@  vect_analyze_data_ref_accesses (vec_info
       data_reference_p dra = datarefs_copy[i];
       stmt_vec_info stmtinfo_a = vinfo_for_stmt (DR_STMT (dra));
       stmt_vec_info lastinfo = NULL;
+      if (! STMT_VINFO_VECTORIZABLE (stmtinfo_a))
+	{
+	  ++i;
+	  continue;
+	}
       for (i = i + 1; i < datarefs_copy.length (); ++i)
 	{
 	  data_reference_p drb = datarefs_copy[i];
 	  stmt_vec_info stmtinfo_b = vinfo_for_stmt (DR_STMT (drb));
+	  if (! STMT_VINFO_VECTORIZABLE (stmtinfo_b))
+	    break;
 
 	  /* ???  Imperfect sorting (non-compatible types, non-modulo
 	     accesses, same accesses) can lead to a group to be artificially
Index: gcc/testsuite/gcc.dg/pr77621.c
===================================================================
--- gcc/testsuite/gcc.dg/pr77621.c	(revision 0)
+++ gcc/testsuite/gcc.dg/pr77621.c	(working copy)
@@ -0,0 +1,11 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+/* { dg-additional-options "-mtune=atom -msse2" { target i?86-*-* x86_64-*-* } } */
+
+void
+foo (double *x, int *y)
+{
+  int i;
+  for (i = 0; i < 8; i++)
+    x[i] -= y[i] * x[i + 1];
+}