diff options
author | Zdenek Dvorak <dvorakz@suse.cz> | 2007-06-09 23:34:08 +0200 |
---|---|---|
committer | Zdenek Dvorak <rakdver@gcc.gnu.org> | 2007-06-09 21:34:08 +0000 |
commit | 9e824336e5ae0b5e293a778dcec78cb01d1bd953 (patch) | |
tree | bfeea6566a3710480f5e9a593f94251b8b3cec45 /gcc/tree-scalar-evolution.c | |
parent | 408a86c03e9236cd848a21a8301e94c0f86edb62 (diff) | |
download | gcc-9e824336e5ae0b5e293a778dcec78cb01d1bd953.tar.gz |
tree-scalar-evolution.c (follow_ssa_edge_in_rhs, [...]): Keep more precise track of the size of the expression.
* tree-scalar-evolution.c (follow_ssa_edge_in_rhs,
follow_ssa_edge_in_condition_phi, follow_ssa_edge): Keep more precise
track of the size of the expression.
* cfghooks.c (merge_blocks): Remove block from loops structure only
after call of the merge_blocks hook.
* gcc.dg/tree-ssa/loop-28.c: New testcase.
From-SVN: r125595
Diffstat (limited to 'gcc/tree-scalar-evolution.c')
-rw-r--r-- | gcc/tree-scalar-evolution.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index 059836154a6..a5444abb384 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -1056,6 +1056,12 @@ follow_ssa_edge_in_rhs (struct loop *loop, tree at_stmt, tree rhs, { /* Match an assignment under the form: "a = b + c". */ + + /* We want only assignments of form "name + name" contribute to + LIMIT, as the other cases do not necessarily contribute to + the complexity of the expression. */ + limit++; + evol = *evolution_of_loop; res = follow_ssa_edge (loop, SSA_NAME_DEF_STMT (rhs0), halting_phi, @@ -1141,6 +1147,13 @@ follow_ssa_edge_in_rhs (struct loop *loop, tree at_stmt, tree rhs, { /* Match an assignment under the form: "a = b - ...". */ + + /* We want only assignments of form "name - name" contribute to + LIMIT, as the other cases do not necessarily contribute to + the complexity of the expression. */ + if (TREE_CODE (rhs1) == SSA_NAME) + limit++; + res = follow_ssa_edge (loop, SSA_NAME_DEF_STMT (rhs0), halting_phi, evolution_of_loop, limit); if (res == t_true) @@ -1255,6 +1268,10 @@ 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 @@ -1338,7 +1355,7 @@ follow_ssa_edge (struct loop *loop, tree def, tree halting_phi, return t_false; /* Give up if the path is longer than the MAX that we allow. */ - if (limit++ > PARAM_VALUE (PARAM_SCEV_MAX_EXPR_SIZE)) + if (limit > PARAM_VALUE (PARAM_SCEV_MAX_EXPR_SIZE)) return t_dont_know; def_loop = loop_containing_stmt (def); @@ -1369,7 +1386,7 @@ follow_ssa_edge (struct loop *loop, tree def, tree halting_phi, /* Inner loop. */ if (flow_loop_nested_p (loop, def_loop)) return follow_ssa_edge_inner_loop_phi - (loop, def, halting_phi, evolution_of_loop, limit); + (loop, def, halting_phi, evolution_of_loop, limit + 1); /* Outer loop. */ return t_false; |