diff options
author | Richard Biener <rguenther@suse.de> | 2016-11-23 14:25:48 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2016-11-23 14:25:48 +0000 |
commit | cbb88345e10ffb70e289408303c58aa01b1a059c (patch) | |
tree | 3ca6d267955784f9df891b67f002317e654d40c1 /gcc/tree-cfgcleanup.c | |
parent | abe405742f6e61756e3e8b08a8bcbc28b482a5ef (diff) | |
download | gcc-cbb88345e10ffb70e289408303c58aa01b1a059c.zip gcc-cbb88345e10ffb70e289408303c58aa01b1a059c.tar.gz gcc-cbb88345e10ffb70e289408303c58aa01b1a059c.tar.bz2 |
re PR tree-optimization/78482 (wrong code at -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu)
2016-11-23 Richard Biener <rguenther@suse.de>
PR tree-optimization/78482
* tree-cfgcleanup.c: Include tree-ssa-loop-niter.h.
(remove_forwarder_block_with_phi): When merging with a loop
header creates a new latch reset number of iteration information
of the loop.
* gcc.dg/torture/pr78482.c: New testcase.
From-SVN: r242754
Diffstat (limited to 'gcc/tree-cfgcleanup.c')
-rw-r--r-- | gcc/tree-cfgcleanup.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c index fe22ed3..1f17d9a 100644 --- a/gcc/tree-cfgcleanup.c +++ b/gcc/tree-cfgcleanup.c @@ -42,6 +42,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-scalar-evolution.h" #include "gimple-match.h" #include "gimple-fold.h" +#include "tree-ssa-loop-niter.h" /* The set of blocks in that at least one of the following changes happened: @@ -885,6 +886,19 @@ remove_forwarder_block_with_phi (basic_block bb) DEST. */ e = single_succ_edge (split_edge (e)); } + else + { + /* If we merge the forwarder into a loop header verify if we + are creating another loop latch edge. If so, reset + number of iteration information of the loop. */ + if (dest->loop_father->header == dest + && dominated_by_p (CDI_DOMINATORS, e->src, dest)) + { + dest->loop_father->any_upper_bound = false; + dest->loop_father->any_likely_upper_bound = false; + free_numbers_of_iterations_estimates_loop (dest->loop_father); + } + } s = redirect_edge_and_branch (e, dest); |