]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/40062 (high memory usage and compile time in SCEV cprop with...
authorRichard Guenther <rguenther@suse.de>
Fri, 8 May 2009 14:14:25 +0000 (14:14 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 8 May 2009 14:14:25 +0000 (14:14 +0000)
2009-05-08  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/40062
* tree-scalar-evolution.c (follow_ssa_edge_in_condition_phi):
Avoid exponential behavior.

From-SVN: r147288

gcc/ChangeLog
gcc/tree-scalar-evolution.c

index cebf9da2cacb563bb402a3573e71f767e50ffefd..f6e9f9cca66ea399ee5da1b39db60850730f911f 100644 (file)
@@ -1,3 +1,9 @@
+2009-05-08  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/40062
+       * tree-scalar-evolution.c (follow_ssa_edge_in_condition_phi):
+       Avoid exponential behavior.
+
 2009-05-07  Janis Johnson  <janis187@us.ibm.com>
 
        PR middle-end/39986
index 2d30410cf308c2aa817a13e4f040509467e48228..83728fce324aa6bbfc5714a04f45bcc1f134edf9 100644 (file)
@@ -1272,10 +1272,6 @@ follow_ssa_edge_in_condition_phi (struct loop *loop,
 
   *evolution_of_loop = evolution_of_branch;
 
-  /* If the phi node is just a copy, do not increase the limit.  */
-  if (PHI_NUM_ARGS (condition_phi) > 1)
-    limit++;
-
   for (i = 1; i < PHI_NUM_ARGS (condition_phi); i++)
     {
       /* Quickly give up when the evolution of one of the branches is
@@ -1283,10 +1279,12 @@ follow_ssa_edge_in_condition_phi (struct loop *loop,
       if (*evolution_of_loop == chrec_dont_know)
        return t_true;
 
+      /* Increase the limit by the PHI argument number to avoid exponential
+        time and memory complexity.  */
       res = follow_ssa_edge_in_condition_phi_branch (i, loop, condition_phi,
                                                     halting_phi,
                                                     &evolution_of_branch,
-                                                    init, limit);
+                                                    init, limit + i);
       if (res == t_false || res == t_dont_know)
        return res;