re PR tree-optimization/50412 (gfortran -Ofast ICE in vect_do_peeling_for_loop_bound)
authorIra Rosen <ira.rosen@linaro.org>
Sun, 18 Sep 2011 08:59:52 +0000 (08:59 +0000)
committerIra Rosen <irar@gcc.gnu.org>
Sun, 18 Sep 2011 08:59:52 +0000 (08:59 +0000)
        PR tree-optimization/50412
        * tree-vect-data-refs.c (vect_analyze_group_access): Fail for
        acceses that require epilogue loop if vectorizing outer loop.

From-SVN: r178940

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/vect/pr50412.f90 [new file with mode: 0644]
gcc/tree-vect-data-refs.c

index e948bdb..be2acbe 100644 (file)
@@ -1,3 +1,9 @@
+2011-09-18  Ira Rosen  <ira.rosen@linaro.org>
+
+       PR tree-optimization/50412
+       * tree-vect-data-refs.c (vect_analyze_group_access): Fail for
+       acceses that require epilogue loop if vectorizing outer loop.
+
 2011-09-17  David S. Miller  <davem@davemloft.net>
 
        * config/sparc/sparc.md (UNSPEC_EDGE8, UNSPEC_EDGE8L,
index 220bfa5..d375576 100644 (file)
@@ -1,3 +1,8 @@
+2011-09-18  Ira Rosen  <ira.rosen@linaro.org>
+
+       PR tree-optimization/50412
+       * gfortran.dg/vect/pr50412.f90: New.
+
 2011-09-16  Jason Merrill  <jason@redhat.com>
 
        PR c++/50424
diff --git a/gcc/testsuite/gfortran.dg/vect/pr50412.f90 b/gcc/testsuite/gfortran.dg/vect/pr50412.f90
new file mode 100644 (file)
index 0000000..4f95741
--- /dev/null
@@ -0,0 +1,12 @@
+! { dg-do compile }
+
+      DOUBLE PRECISION AK,AI,AAE
+      COMMON/com/AK(36),AI(4,4),AAE(8,4),ii,jj
+      DO 20 II=1,4
+        DO 21 JJ=1,4
+          AK(n)=AK(n)-AAE(I,II)*AI(II,JJ)
+   21   CONTINUE
+   20 CONTINUE
+      END
+
+! { dg-final { cleanup-tree-dump "vect" } }
index 33ccf34..e1cbecd 100644 (file)
@@ -2060,6 +2060,10 @@ vect_analyze_group_access (struct data_reference *dr)
   HOST_WIDE_INT dr_step = TREE_INT_CST_LOW (step);
   HOST_WIDE_INT stride, last_accessed_element = 1;
   bool slp_impossible = false;
+  struct loop *loop = NULL;
+
+  if (loop_vinfo)
+    loop = LOOP_VINFO_LOOP (loop_vinfo);
 
   /* For interleaving, STRIDE is STEP counted in elements, i.e., the size of the
      interleaving group (including gaps).  */
@@ -2090,11 +2094,18 @@ vect_analyze_group_access (struct data_reference *dr)
 
          if (loop_vinfo)
            {
-             LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo) = true;
-
              if (vect_print_dump_info (REPORT_DETAILS))
                fprintf (vect_dump, "Data access with gaps requires scalar "
                                    "epilogue loop");
+              if (loop->inner)
+                {
+                  if (vect_print_dump_info (REPORT_DETAILS))
+                    fprintf (vect_dump, "Peeling for outer loop is not"
+                                        " supported");
+                  return false;
+                }
+
+              LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo) = true;
            }
 
          return true;
@@ -2277,10 +2288,17 @@ vect_analyze_group_access (struct data_reference *dr)
       /* There is a gap in the end of the group.  */
       if (stride - last_accessed_element > 0 && loop_vinfo)
        {
-         LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo) = true;
          if (vect_print_dump_info (REPORT_DETAILS))
            fprintf (vect_dump, "Data access with gaps requires scalar "
                                "epilogue loop");
+          if (loop->inner)
+            {
+              if (vect_print_dump_info (REPORT_DETAILS))
+                fprintf (vect_dump, "Peeling for outer loop is not supported");
+              return false;
+            }
+
+          LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo) = true;
        }
     }