diff options
author | Richard Biener <rguenther@suse.de> | 2015-06-03 07:57:13 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2015-06-03 07:57:13 +0000 |
commit | b9b79ba4264cf635fbd3cc66530c5eb83d3ce568 (patch) | |
tree | 1c1bfc05a918621344364216fc91756fa3382cc6 /gcc/tree-scalar-evolution.c | |
parent | e185f450b8933bcf96e08ddfb15df842e55452d9 (diff) | |
download | gcc-b9b79ba4264cf635fbd3cc66530c5eb83d3ce568.zip gcc-b9b79ba4264cf635fbd3cc66530c5eb83d3ce568.tar.gz gcc-b9b79ba4264cf635fbd3cc66530c5eb83d3ce568.tar.bz2 |
re PR middle-end/66375 (wrong code at -O2 and -O3 on x86_64-linux-gnu)
2015-06-03 Richard Biener <rguenther@suse.de>
PR tree-optimization/66375
* tree-scalar-evolution.c (follow_ssa_edge_binary): First
add to the evolution before following SSA edges.
* gcc.dg/torture/pr66375.c: New testcase.
From-SVN: r224060
Diffstat (limited to 'gcc/tree-scalar-evolution.c')
-rw-r--r-- | gcc/tree-scalar-evolution.c | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index 013fc50..3a2c284 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -958,27 +958,25 @@ follow_ssa_edge_binary (struct loop *loop, gimple at_stmt, limit++; evol = *evolution_of_loop; - res = follow_ssa_edge - (loop, SSA_NAME_DEF_STMT (rhs0), halting_phi, &evol, limit); - - if (res == t_true) - *evolution_of_loop = add_to_evolution + evol = add_to_evolution (loop->num, chrec_convert (type, evol, at_stmt), code, rhs1, at_stmt); - + res = follow_ssa_edge + (loop, SSA_NAME_DEF_STMT (rhs0), halting_phi, &evol, limit); + if (res == t_true) + *evolution_of_loop = evol; else if (res == t_false) { + *evolution_of_loop = add_to_evolution + (loop->num, + chrec_convert (type, *evolution_of_loop, at_stmt), + code, rhs0, at_stmt); res = follow_ssa_edge (loop, SSA_NAME_DEF_STMT (rhs1), halting_phi, evolution_of_loop, limit); - if (res == t_true) - *evolution_of_loop = add_to_evolution - (loop->num, - chrec_convert (type, *evolution_of_loop, at_stmt), - code, rhs0, at_stmt); - + ; else if (res == t_dont_know) *evolution_of_loop = chrec_dont_know; } @@ -991,15 +989,15 @@ follow_ssa_edge_binary (struct loop *loop, gimple at_stmt, { /* Match an assignment under the form: "a = b + ...". */ + *evolution_of_loop = add_to_evolution + (loop->num, chrec_convert (type, *evolution_of_loop, + at_stmt), + code, rhs1, at_stmt); res = follow_ssa_edge (loop, SSA_NAME_DEF_STMT (rhs0), halting_phi, evolution_of_loop, limit); if (res == t_true) - *evolution_of_loop = add_to_evolution - (loop->num, chrec_convert (type, *evolution_of_loop, - at_stmt), - code, rhs1, at_stmt); - + ; else if (res == t_dont_know) *evolution_of_loop = chrec_dont_know; } @@ -1009,15 +1007,15 @@ follow_ssa_edge_binary (struct loop *loop, gimple at_stmt, { /* Match an assignment under the form: "a = ... + c". */ + *evolution_of_loop = add_to_evolution + (loop->num, chrec_convert (type, *evolution_of_loop, + at_stmt), + code, rhs0, at_stmt); res = follow_ssa_edge (loop, SSA_NAME_DEF_STMT (rhs1), halting_phi, evolution_of_loop, limit); if (res == t_true) - *evolution_of_loop = add_to_evolution - (loop->num, chrec_convert (type, *evolution_of_loop, - at_stmt), - code, rhs0, at_stmt); - + ; else if (res == t_dont_know) *evolution_of_loop = chrec_dont_know; } @@ -1042,13 +1040,13 @@ follow_ssa_edge_binary (struct loop *loop, gimple at_stmt, if (TREE_CODE (rhs1) == SSA_NAME) limit++; + *evolution_of_loop = add_to_evolution + (loop->num, chrec_convert (type, *evolution_of_loop, at_stmt), + MINUS_EXPR, rhs1, at_stmt); res = follow_ssa_edge (loop, SSA_NAME_DEF_STMT (rhs0), halting_phi, evolution_of_loop, limit); if (res == t_true) - *evolution_of_loop = add_to_evolution - (loop->num, chrec_convert (type, *evolution_of_loop, at_stmt), - MINUS_EXPR, rhs1, at_stmt); - + ; else if (res == t_dont_know) *evolution_of_loop = chrec_dont_know; } |