re PR tree-optimization/37539 (Hang for -O3)
authorIra Rosen <irar@il.ibm.com>
Sun, 21 Sep 2008 08:36:07 +0000 (08:36 +0000)
committerIra Rosen <irar@gcc.gnu.org>
Sun, 21 Sep 2008 08:36:07 +0000 (08:36 +0000)
PR tree-optimization/37539
* tree-vect-transform.c (vect_transform_strided_load): Save vector
statement in related statement field only for the first load of the
group of loads with the same data reference.

From-SVN: r140522

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr37539.c [new file with mode: 0644]
gcc/tree-vect-transform.c

index f659c2e..1ce145f 100644 (file)
@@ -1,3 +1,10 @@
+2008-09-21  Ira Rosen  <irar@il.ibm.com>
+
+       PR tree-optimization/37539
+       * tree-vect-transform.c (vect_transform_strided_load): Save vector
+       statement in related statement field only for the first load of the
+       group of loads with the same data reference.
+
 2008-09-20  Adam Nemet  <anemet@caviumnetworks.com>
 
        * config/mips/mips.h (TUNE_OCTEON): New macro.
index a2c85e2..6f92376 100644 (file)
@@ -1,3 +1,8 @@
+2008-09-21  Ira Rosen  <irar@il.ibm.com>
+
+       PR tree-optimization/37539
+       * gcc.dg/vect/pr37539.c: New test.
+
 2008-09-20  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR rtl-optimization/33642
diff --git a/gcc/testsuite/gcc.dg/vect/pr37539.c b/gcc/testsuite/gcc.dg/vect/pr37539.c
new file mode 100644 (file)
index 0000000..1d569a9
--- /dev/null
@@ -0,0 +1,45 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+__attribute__ ((noinline)) void
+ayuv2yuyv_ref (int *d, int *src, int n)
+{
+  char *dest = (char *)d;
+  int i;
+
+  for(i=0;i<n/2;i++){
+    dest[i*4 + 0] = (src[i*2 + 0])>>16;
+    dest[i*4 + 1] = (src[i*2 + 1])>>8;
+    dest[i*4 + 2] = (src[i*2 + 0])>>16;
+    dest[i*4 + 3] = (src[i*2 + 0])>>0;
+  }
+
+  /* Check results.  */
+  for(i=0;i<n/2;i++){
+   if (dest[i*4 + 0] != (src[i*2 + 0])>>16
+       || dest[i*4 + 1] != (src[i*2 + 1])>>8
+       || dest[i*4 + 2] != (src[i*2 + 0])>>16
+       || dest[i*4 + 3] != (src[i*2 + 0])>>0) 
+     abort();
+  }
+}
+
+int main ()
+{
+  int d[256], src[128], i;
+  for (i = 0; i < 128; i++)
+    src[i] = i; 
+  
+  ayuv2yuyv_ref(d, src, 128);
+
+  return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_strided_wide } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
+
+
index 06d6791..4965da4 100644 (file)
@@ -5947,17 +5947,24 @@ vect_transform_strided_load (gimple stmt, VEC(tree,heap) *dr_chain, int size,
            STMT_VINFO_VEC_STMT (vinfo_for_stmt (next_stmt)) = new_stmt;
          else
             {
-             gimple prev_stmt =
-               STMT_VINFO_VEC_STMT (vinfo_for_stmt (next_stmt));
-             gimple rel_stmt =
-               STMT_VINFO_RELATED_STMT (vinfo_for_stmt (prev_stmt));
-             while (rel_stmt)
-               {
-                 prev_stmt = rel_stmt;
-                 rel_stmt = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (rel_stmt));
-               }
-             STMT_VINFO_RELATED_STMT (vinfo_for_stmt (prev_stmt)) = new_stmt;
+              if (!DR_GROUP_SAME_DR_STMT (vinfo_for_stmt (next_stmt)))
+                {
+                 gimple prev_stmt =
+                   STMT_VINFO_VEC_STMT (vinfo_for_stmt (next_stmt));
+                 gimple rel_stmt =
+                   STMT_VINFO_RELATED_STMT (vinfo_for_stmt (prev_stmt));
+                 while (rel_stmt)
+                   {
+                     prev_stmt = rel_stmt;
+                     rel_stmt = 
+                        STMT_VINFO_RELATED_STMT (vinfo_for_stmt (rel_stmt));
+                   }
+
+                 STMT_VINFO_RELATED_STMT (vinfo_for_stmt (prev_stmt)) = 
+                    new_stmt;
+                }
             }
+
          next_stmt = DR_GROUP_NEXT_DR (vinfo_for_stmt (next_stmt));
          gap_count = 1;
          /* If NEXT_STMT accesses the same DR as the previous statement,