This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR64404


On Mon, 12 Jan 2015, Richard Biener wrote:

> 
> I am testing the following patch to fix a latent bug in the vectorizer
> dealing with redundant DRs.
> 
> Bootstrap and regtest pending on x86_64-unknown-linux-gnu.

Which shows the patch is bogus.  Instead we are not prepared to
handle this situation.  Thus the following patch rejects it, making
the testcase a runtime one as well.

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

Richard.

2015-01-13  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/64404
	* tree-vect-stmts.c (vectorizable_load): Reject conflicting
	SLP types for CSEd loads.

	* gcc.dg/vect/pr64404.c: New testcase.

Index: gcc/tree-vect-stmts.c
===================================================================
--- gcc/tree-vect-stmts.c	(revision 219520)
+++ gcc/tree-vect-stmts.c	(working copy)
@@ -5791,6 +5791,20 @@ vectorizable_load (gimple stmt, gimple_s
 			     "group loads with negative dependence distance\n");
 	  return false;
 	}
+
+      /* Similarly when the stmt is a load that is both part of a SLP
+         instance and a loop vectorized stmt via the same-dr mechanism
+	 we have to give up.  */
+      if (STMT_VINFO_GROUP_SAME_DR_STMT (stmt_info)
+	  && (STMT_SLP_TYPE (stmt_info)
+	      != STMT_SLP_TYPE (vinfo_for_stmt
+				 (STMT_VINFO_GROUP_SAME_DR_STMT (stmt_info)))))
+	{
+	  if (dump_enabled_p ())
+	    dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+			     "conflicting SLP types for CSEd load\n");
+	  return false;
+	}
     }
 
 
Index: gcc/testsuite/gcc.dg/vect/pr64404.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/pr64404.c	(revision 0)
+++ gcc/testsuite/gcc.dg/vect/pr64404.c	(working copy)
@@ -0,0 +1,59 @@
+/* { dg-do run } */
+/* { dg-additional-options "--param=sccvn-max-alias-queries-per-access=1" } */
+
+#include "tree-vect.h"
+
+extern void abort (void);
+
+typedef struct
+{
+  int l, h;
+} tFPinterval;
+
+tFPinterval X[1024];
+tFPinterval Y[1024];
+tFPinterval Z[1024];
+
+void __attribute__((noinline))
+Compute (void)
+{
+  int d;
+  for (d = 0; d < 1024; d++)
+    {
+      Y[d].l = X[d].l + X[d].h;
+      Y[d].h = Y[d].l;
+      Z[d].l = X[d].l;
+      Z[d].h = X[d].h;
+    }
+}
+
+int
+main (void)
+{
+  int d;
+
+  check_vect ();
+
+  for (d = 0; d < 1024; d++)
+    {
+      X[d].l = d;
+      X[d].h = d + 1;
+      __asm__ volatile ("");
+    }
+
+  Compute ();
+
+  for (d = 0; d < 1024; d++)
+    {
+      if (Y[d].l != X[d].l + X[d].h
+	 || Y[d].h != Y[d].l
+	 || Z[d].l != X[d].l
+	 || Z[d].h != X[d].h)
+	abort ();
+      __asm__ volatile ("");
+    }
+
+  return 0;
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]