]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/40421 (Revision 148352 failed 416.gamess in SPEC CPU 2006)
authorRichard Guenther <rguenther@suse.de>
Sat, 13 Jun 2009 17:02:17 +0000 (17:02 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Sat, 13 Jun 2009 17:02:17 +0000 (17:02 +0000)
2009-06-13  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/40389
* tree-predcom.c (should_unroll_loop_p): Remove.
(tree_predictive_commoning_loop): Use can_unroll_loop_p.

* gfortran.fortran-torture/compile/pr40421.f: New testcase.

From-SVN: r148458

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.fortran-torture/compile/pr40421.f [new file with mode: 0644]
gcc/tree-predcom.c

index 27398ce315578f25bf5af6f597fd41e9e63a7ed2..cc32b118b5d9eb0ae52bf96217855b2c3169c481 100644 (file)
@@ -1,3 +1,9 @@
+2009-06-13  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/40389
+       * tree-predcom.c (should_unroll_loop_p): Remove.
+       (tree_predictive_commoning_loop): Use can_unroll_loop_p.
+
 2009-06-13  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
        * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin):
index 62b77f61e49af6b9dca1c0ec2cb54dfa947d8d6c..44619103befe9fa486342f45dca67bc7121fc206 100644 (file)
@@ -1,3 +1,8 @@
+2009-06-13  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/40389
+       * gfortran.fortran-torture/compile/pr40421.f: New testcase.
+
 2009-06-12  Aldy Hernandez  <aldyh@redhat.com>
 
        * gcc.dg/old-style-prom-3.c: Add column info.
diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/pr40421.f b/gcc/testsuite/gfortran.fortran-torture/compile/pr40421.f
new file mode 100644 (file)
index 0000000..de7664c
--- /dev/null
@@ -0,0 +1,18 @@
+      SUBROUTINE VROT2(N,DIS)
+      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
+      PARAMETER(ZERO=0.0D+00)
+      COMMON /SYMSPD/ PTR(3,144)
+      DIMENSION DIS(3,2),TMP(3,2)
+      DO I = 1,3
+        TMP1 = ZERO
+        DO J = 1,3
+          TMP1 = TMP1 + PTR(I,N+J)
+        END DO
+        TMP(I,1) = TMP1
+      END DO
+      DO I = 1,3
+        DIS(I,1) = TMP(I,1)
+      END DO
+      RETURN
+      END
+
index 7ebd6c082ad11070dcfccd145b01251e72807103..5d8bf4d27042eccf106e0e6f97b0b9030e93cb0b 100644 (file)
@@ -1870,43 +1870,6 @@ execute_pred_commoning_cbck (struct loop *loop, void *data)
   execute_pred_commoning (loop, dta->chains, dta->tmp_vars);
 }
 
-/* Returns true if we can and should unroll LOOP FACTOR times.  Number
-   of iterations of the loop is returned in NITER.  */
-
-static bool
-should_unroll_loop_p (struct loop *loop, unsigned factor,
-                     struct tree_niter_desc *niter)
-{
-  edge exit;
-
-  if (factor == 1)
-    return false;
-
-  /* Check whether unrolling is possible.  We only want to unroll loops
-     for that we are able to determine number of iterations.  We also
-     want to split the extra iterations of the loop from its end,
-     therefore we require that the loop has precisely one
-     exit.  */
-
-  exit = single_dom_exit (loop);
-  if (!exit)
-    return false;
-
-  if (!number_of_iterations_exit (loop, exit, niter, false))
-    return false;
-
-  /* And of course, we must be able to duplicate the loop.  */
-  if (!can_duplicate_loop_p (loop))
-    return false;
-
-  /* The final loop should be small enough.  */
-  if (tree_num_loop_insns (loop, &eni_size_weights) * factor
-      > (unsigned) PARAM_VALUE (PARAM_MAX_UNROLLED_INSNS))
-    return false;
-
-  return true;
-}
-
 /* Base NAME and all the names in the chain of phi nodes that use it
    on variable VAR.  The phi nodes are recognized by being in the copies of
    the header of the LOOP.  */
@@ -2544,7 +2507,8 @@ tree_predictive_commoning_loop (struct loop *loop)
      that its number of iterations is divisible by the factor.  */
   unroll_factor = determine_unroll_factor (chains);
   scev_reset ();
-  unroll = should_unroll_loop_p (loop, unroll_factor, &desc);
+  unroll = (unroll_factor > 1
+           && can_unroll_loop_p (loop, unroll_factor, &desc));
   exit = single_dom_exit (loop);
 
   /* Execute the predictive commoning transformations, and possibly unroll the