summaryrefslogtreecommitdiff
path: root/gcc/tree-cfgcleanup.c
diff options
context:
space:
mode:
authoramker <amker@138bc75d-0d04-0410-961f-82ee72b054a4>2014-03-13 02:40:08 +0000
committeramker <amker@138bc75d-0d04-0410-961f-82ee72b054a4>2014-03-13 02:40:08 +0000
commit31a370d3dbe135ad1a1e186e2e62421fe2b1e1f6 (patch)
treea7906c5a290183421fef8db4d70832d51442a831 /gcc/tree-cfgcleanup.c
parent4df12aa29efd9950b5bcbe15c207e61e11c16435 (diff)
downloadgcc-31a370d3dbe135ad1a1e186e2e62421fe2b1e1f6.tar.gz
* tree-cfgcleanup.c (remove_forwarder_block_with_phi): Record
BB's single pred and update the father loop's latch info later. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208527 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-cfgcleanup.c')
-rw-r--r--gcc/tree-cfgcleanup.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 926d3000dc5..08401dd2db6 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -820,6 +820,12 @@ remove_forwarder_block_with_phi (basic_block bb)
&& DECL_NONLOCAL (gimple_label_label (label)))
return false;
+ /* Record BB's single pred in case we need to update the father
+ loop's latch information later. */
+ basic_block pred = NULL;
+ if (single_pred_p (bb))
+ pred = single_pred (bb);
+
/* Redirect each incoming edge to BB to DEST. */
while (EDGE_COUNT (bb->preds) > 0)
{
@@ -904,6 +910,11 @@ remove_forwarder_block_with_phi (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 = pred;
+
/* Remove BB since all of BB's incoming edges have been redirected
to DEST. */
delete_basic_block (bb);