------- Comment #3 from rguenth at gcc dot gnu dot org 2009-05-08 09:52 ------- Or rather
Index: tree-scalar-evolution.c =================================================================== --- tree-scalar-evolution.c (revision 147237) +++ tree-scalar-evolution.c (working copy) @@ -1320,11 +1320,7 @@ follow_ssa_edge_in_condition_phi (struct *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 @@ -1332,10 +1328,12 @@ follow_ssa_edge_in_condition_phi (struct 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; which more follows the logic of using the original limit for the walk of argument zero. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40062