OSDN Git Service

2012-07-06 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 6 Jul 2012 09:20:19 +0000 (09:20 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 6 Jul 2012 09:20:19 +0000 (09:20 +0000)
        Backport from mainline
2012-04-11  Richard Guenther  <rguenther@suse.de>

PR middle-end/52621
* tree-chrec.c (evolution_function_is_invariant_rec_p): Properly
consider loop nesting.
(evolution_function_is_univariate_p): Properly check the remainder
for chrecs.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@189312 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr52621.f90 [new file with mode: 0644]
gcc/tree-chrec.c

index 542a35e..886c0e6 100644 (file)
@@ -1,3 +1,14 @@
+2012-07-06  Richard Guenther  <rguenther@suse.de>
+
+       Backport from mainline
+       2012-04-11  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/52621
+       * tree-chrec.c (evolution_function_is_invariant_rec_p): Properly
+       consider loop nesting.
+       (evolution_function_is_univariate_p): Properly check the remainder
+       for chrecs.
+
 2012-07-05  Pat Haugen <pthaugen@us.ibm.com>
 
        Backport from mainline
index b95a305..ccd328f 100644 (file)
@@ -1,3 +1,11 @@
+2012-07-06  Richard Guenther  <rguenther@suse.de>
+
+       Backport from mainline
+       2012-04-11  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/52621
+       * gfortran.dg/pr52621.f90: New testcase.
+
 2012-07-05  Pat Haugen <pthaugen@us.ibm.com>
 
        Backport from mainline
diff --git a/gcc/testsuite/gfortran.dg/pr52621.f90 b/gcc/testsuite/gfortran.dg/pr52621.f90
new file mode 100644 (file)
index 0000000..d305e4d
--- /dev/null
@@ -0,0 +1,20 @@
+! { dg-do compile }
+! { dg-options "-O2 -fprefetch-loop-arrays" }
+
+      SUBROUTINE GHDSYM(IZ,IS,LMMAX,S,LMS,Y,L2M,DRL,NLAY2,K0,DCUT)!,
+!
+      COMPLEX Y(L2M,L2M),H(33),S(LMS)
+      COMPLEX RU,CI,CZ,K0,FF,Z,Z1,Z2,Z3,ST
+!
+      DO 140 KK=1,4
+            DO 130 L=1,L2M
+               L1=L*L-L
+               DO 120 M=1,L
+                  IPM=L1+M
+                  IMM=L1-M+2
+                  S(IPM)=S(IPM)+Z3*Y(L,M)
+                  IF (M.NE.1) S(IMM)=S(IMM)+Z3*Y(M-1,L)*CSGN
+120            CONTINUE
+130         CONTINUE
+140   CONTINUE
+      END
index fbd61c0..38dca4a 100644 (file)
@@ -1011,6 +1011,8 @@ evolution_function_is_invariant_rec_p (tree chrec, int loopnum)
   if (TREE_CODE (chrec) == POLYNOMIAL_CHREC)
     {
       if (CHREC_VARIABLE (chrec) == (unsigned) loopnum
+         || flow_loop_nested_p (get_loop (loopnum),
+                                get_loop (CHREC_VARIABLE (chrec)))
          || !evolution_function_is_invariant_rec_p (CHREC_RIGHT (chrec),
                                                     loopnum)
          || !evolution_function_is_invariant_rec_p (CHREC_LEFT (chrec),
@@ -1114,6 +1116,8 @@ evolution_function_is_univariate_p (const_tree chrec)
          break;
 
        default:
+         if (tree_contains_chrecs (CHREC_LEFT (chrec), NULL))
+           return false;
          break;
        }
 
@@ -1127,6 +1131,8 @@ evolution_function_is_univariate_p (const_tree chrec)
          break;
 
        default:
+         if (tree_contains_chrecs (CHREC_RIGHT (chrec), NULL))
+           return false;
          break;
        }