summaryrefslogtreecommitdiff
path: root/gcc/tree-scalar-evolution.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-08 12:24:22 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-08 12:24:22 +0000
commitaebe538b0142a61fedcb2731e035f41e968f6cba (patch)
treeaabbf2fc3c6814aff869e013b040c9d31041d85e /gcc/tree-scalar-evolution.c
parente0bd4156d6613e878cafcb23f52d8c3e72d928eb (diff)
downloadgcc-aebe538b0142a61fedcb2731e035f41e968f6cba.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147283 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-scalar-evolution.c')
-rw-r--r--gcc/tree-scalar-evolution.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index 2d31f9f534c..b3990c6bfe1 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;