diff options
author | amker <amker@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-02-26 01:49:35 +0000 |
---|---|---|
committer | amker <amker@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-02-26 01:49:35 +0000 |
commit | 3c2e3ed6de5a1bd597c5a6e666013173aeb6ccab (patch) | |
tree | 6950f4f889e9bdb8f3310b7162ef11948dcabffc /gcc/tree-cfgcleanup.c | |
parent | 3ed779c3572d4afabe6189aff2e1068872cd891e (diff) | |
download | gcc-3c2e3ed6de5a1bd597c5a6e666013173aeb6ccab.tar.gz |
PR target/60280
* tree-cfgcleanup.c (tree_forwarder_block_p): Protect loop
preheaders and latches only if requested. Fix latch if it
is removed.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Set
LOOPS_HAVE_PREHEADERS.
PR target/60280
* gnat.dg/renaming5.adb: Change to two expected gotos.
* gcc.dg/tree-ssa/pr21559.c: Change back to three expected
jump threads.
* gcc.dg/tree-prof/update-loopch.c: Check two "Invalid sum"
messages for removed basic block.
* gcc.dg/tree-ssa/ivopt_1.c: Fix unreliable scanning string.
* gcc.dg/tree-ssa/ivopt_2.c: Ditto.
* gcc.dg/tree-ssa/ivopt_3.c: Ditto.
* gcc.dg/tree-ssa/ivopt_4.c: Ditto.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208165 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-cfgcleanup.c')
-rw-r--r-- | gcc/tree-cfgcleanup.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c index 922ae0d82a6..b5c384b902c 100644 --- a/gcc/tree-cfgcleanup.c +++ b/gcc/tree-cfgcleanup.c @@ -308,14 +308,24 @@ tree_forwarder_block_p (basic_block bb, bool phi_wanted) if (current_loops) { basic_block dest; - /* Protect loop latches, headers and preheaders. */ + /* Protect loop headers. */ if (bb->loop_father->header == bb) return false; - dest = EDGE_SUCC (bb, 0)->dest; + dest = EDGE_SUCC (bb, 0)->dest; + /* Protect loop preheaders and latches if requested. */ if (dest->loop_father->header == dest) - return false; + { + if (loops_state_satisfies_p (LOOPS_HAVE_PREHEADERS) + && bb->loop_father->header != dest) + return false; + + if (loops_state_satisfies_p (LOOPS_HAVE_SIMPLE_LATCHES) + && bb->loop_father->header == dest) + return false; + } } + return true; } @@ -497,6 +507,11 @@ remove_forwarder_block (basic_block bb) set_immediate_dominator (CDI_DOMINATORS, dest, dom); } + /* Adjust latch infomation of BB's parent loop as otherwise + the cfg hook has a hard time not to kill the loop. */ + if (current_loops && bb->loop_father->latch == bb) + bb->loop_father->latch = dest; + /* And kill the forwarder block. */ delete_basic_block (bb); |