OSDN Git Service

Backport from mainline
authorabel <abel@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 20 Jul 2012 08:49:52 +0000 (08:49 +0000)
committerabel <abel@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 20 Jul 2012 08:49:52 +0000 (08:49 +0000)
        2012-03-06  Andrey Belevantsev  <abel@ispras.ru>

        PR rtl-optimization/52250
        * sel-sched-ir.c (maybe_tidy_empty_bb): Try harder to find a bb
        to put note list into.  Unconditionally call move_bb_info.
        (move_bb_info): Do not assert the blocks being in the same region,
        just drop the note list if they are not.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@189705 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/sel-sched-ir.c

index ba6f9b9..1dd1588 100644 (file)
@@ -1,3 +1,14 @@
+2012-07-20  Andrey Belevantsev  <abel@ispras.ru>
+
+       Backport from mainline
+       2012-03-06  Andrey Belevantsev  <abel@ispras.ru>
+
+       PR rtl-optimization/52250
+       * sel-sched-ir.c (maybe_tidy_empty_bb): Try harder to find a bb
+       to put note list into.  Unconditionally call move_bb_info.
+       (move_bb_info): Do not assert the blocks being in the same region,
+       just drop the note list if they are not.
+
 2012-07-19  Eric Botcazou  <ebotcazou@adacore.com>
 
        * config/sparc/sparc.md (adddi3_insn_sp32): Add earlyclobber.
@@ -34,9 +45,9 @@
 
 2012-07-18  Ralf Corsépius  <ralf.corsepius@rtems.org>
 
-       * config.gcc (v850-*-rtems*): New target.
-       * config/v850/rtems.h: New.
-       * config/v850/t-rtems: New.
+       * config.gcc (v850-*-rtems*): New target.
+       * config/v850/rtems.h: New.
+       * config/v850/t-rtems: New.
 
 2012-07-18  Nick Clifton  <nickc@redhat.com>
 
index a93cd68..c53d2e1 100644 (file)
@@ -3658,7 +3658,7 @@ sel_recompute_toporder (void)
 static bool
 maybe_tidy_empty_bb (basic_block bb)
 {
-  basic_block succ_bb, pred_bb;
+  basic_block succ_bb, pred_bb, note_bb;
   VEC (basic_block, heap) *dom_bbs;
   edge e;
   edge_iterator ei;
@@ -3697,6 +3697,17 @@ maybe_tidy_empty_bb (basic_block bb)
   pred_bb = NULL;
   dom_bbs = NULL;
 
+  /* Save a pred/succ from the current region to attach the notes to.  */
+  note_bb = NULL;
+  FOR_EACH_EDGE (e, ei, bb->preds)
+    if (in_current_region_p (e->src))
+      {
+       note_bb = e->src;
+       break;
+      }
+  if (note_bb == NULL)
+    note_bb = succ_bb;
+
   /* Redirect all non-fallthru edges to the next bb.  */
   while (rescan_p)
     {
@@ -3746,10 +3757,8 @@ maybe_tidy_empty_bb (basic_block bb)
   else
     {
       /* This is a block without fallthru predecessor.  Just delete it.  */
-      gcc_assert (pred_bb != NULL);
-
-      if (in_current_region_p (pred_bb))
-       move_bb_info (pred_bb, bb);
+      gcc_assert (note_bb);
+      move_bb_info (note_bb, bb);
       remove_empty_bb (bb, true);
     }
 
@@ -5231,10 +5240,9 @@ sel_remove_bb (basic_block bb, bool remove_from_cfg_p)
 static void
 move_bb_info (basic_block merge_bb, basic_block empty_bb)
 {
-  gcc_assert (in_current_region_p (merge_bb));
-
-  concat_note_lists (BB_NOTE_LIST (empty_bb),
-                    &BB_NOTE_LIST (merge_bb));
+  if (in_current_region_p (merge_bb))
+    concat_note_lists (BB_NOTE_LIST (empty_bb),
+                      &BB_NOTE_LIST (merge_bb));
   BB_NOTE_LIST (empty_bb) = NULL_RTX;
 
 }