diff options
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/tree-scalar-evolution.c | 8 |
2 files changed, 9 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ca1f483..49e0610 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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-08 Paolo Bonzini <bonzini@gnu.org> PR rtl-optimization/33928 diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index 2d31f9f..b3990c6 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -1319,11 +1319,7 @@ 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. */ n = gimple_phi_num_args (condition_phi); - if (n > 1) - limit++; - for (i = 1; i < n; i++) { /* Quickly give up when the evolution of one of the branches is @@ -1331,10 +1327,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; |