2012-03-26 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 26 Mar 2012 14:14:51 +0000 (14:14 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 26 Mar 2012 14:14:51 +0000 (14:14 +0000)
PR tree-optimization/52701
* tree-vect-loop.c (vect_analyze_scalar_cycles_1): Always
compute and set the evolution part of PHI nodes.

* gfortran.dg/pr52701.f90: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185800 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 636ef21..4dce347 100644 (file)
@@ -1,5 +1,11 @@
 2012-03-26  Richard Guenther  <rguenther@suse.de>
 
+       PR tree-optimization/52701
+       * tree-vect-loop.c (vect_analyze_scalar_cycles_1): Always
+       compute and set the evolution part of PHI nodes.
+
+2012-03-26  Richard Guenther  <rguenther@suse.de>
+
        PR tree-optimization/52721
        * tree-vect-stmts.c (vect_init_vector): Handle scalars.
 
index 88c3ee2..867b8ca 100644 (file)
@@ -1,3 +1,8 @@
+2012-03-26  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/52701
+       * gfortran.dg/pr52701.f90: New testcase.
+
 2012-03-26  Ulrich Weigand  <ulrich.weigand@linaro.org>
 
        PR tree-optimization/52686
diff --git a/gcc/testsuite/gfortran.dg/pr52701.f90 b/gcc/testsuite/gfortran.dg/pr52701.f90
new file mode 100644 (file)
index 0000000..5834318
--- /dev/null
@@ -0,0 +1,20 @@
+! { dg-do compile }
+! { dg-options "-O3" }
+function pr52701 (x, z, e, f, g, l)
+  integer a, b, c, d, e, f, g, i, j, l, pr52701
+  double precision x(e), z(e*e)
+  do i = l, f
+    do j = l, i
+      d = 0
+      do a = 1, g
+        c = a - g
+        do b = 1, g
+          d = d + 1
+          c = c + g
+          z(d) = z(d) / (x(i) + x(j) - x(f + a) - x(f + b))
+        end do
+      end do
+    end do
+  end do
+  pr52701 = c
+end
index 1b4ed88..16515dc 100644 (file)
@@ -565,11 +565,15 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
       /* Analyze the evolution function.  */
       access_fn = analyze_scalar_evolution (loop, def);
       if (access_fn)
-       STRIP_NOPS (access_fn);
-      if (access_fn && vect_print_dump_info (REPORT_DETAILS))
        {
-         fprintf (vect_dump, "Access function of PHI: ");
-         print_generic_expr (vect_dump, access_fn, TDF_SLIM);
+         STRIP_NOPS (access_fn);
+         if (vect_print_dump_info (REPORT_DETAILS))
+           {
+             fprintf (vect_dump, "Access function of PHI: ");
+             print_generic_expr (vect_dump, access_fn, TDF_SLIM);
+           }
+         STMT_VINFO_LOOP_PHI_EVOLUTION_PART (stmt_vinfo)
+           = evolution_part_in_loop_num (access_fn, loop->num);
        }
 
       if (!access_fn
@@ -579,8 +583,6 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
          continue;
        }
 
-      STMT_VINFO_LOOP_PHI_EVOLUTION_PART (stmt_vinfo)
-       = evolution_part_in_loop_num (access_fn, loop->num);
       gcc_assert (STMT_VINFO_LOOP_PHI_EVOLUTION_PART (stmt_vinfo) != NULL_TREE);
 
       if (vect_print_dump_info (REPORT_DETAILS))