]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-cfgcleanup.c (remove_forwarder_block_with_phi): Record BB's single pred and...
authorBin Cheng <bin.cheng@arm.com>
Thu, 13 Mar 2014 02:40:08 +0000 (02:40 +0000)
committerBin Cheng <amker@gcc.gnu.org>
Thu, 13 Mar 2014 02:40:08 +0000 (02:40 +0000)
* tree-cfgcleanup.c (remove_forwarder_block_with_phi): Record
BB's single pred and update the father loop's latch info later.

From-SVN: r208527

gcc/ChangeLog
gcc/tree-cfgcleanup.c

index c199901dd37c249c68e2a38cdb56f0e626de96cb..beea3437a4731d4dc480ad4581913d5d7a1c59fe 100644 (file)
@@ -1,3 +1,8 @@
+2014-03-13  Bin Cheng  <bin.cheng@arm.com>
+
+       * tree-cfgcleanup.c (remove_forwarder_block_with_phi): Record
+       BB's single pred and update the father loop's latch info later.
+
 2014-03-12  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
        * config/rs6000/vector.md (VEC_L): Add V1TI mode to vector types.
index 926d3000dc51884125c7cad0a885557758550551..08401dd2db64d93952514ad2fc718c1931d470bd 100644 (file)
@@ -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);