http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46204

Alexander Monakov <amonakov at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |amonakov at gcc dot gnu.org

--- Comment #2 from Alexander Monakov <amonakov at gcc dot gnu.org> 2010-11-02 
17:30:54 UTC ---
The scheduler is confused by a conditional jump to the next instruction (and
the fact that the containing BB has only one outgoing edge, which is also
marked fallthru).  When we delete the successor block, we don't notice that we
are also deleting the label used in that fallthru condjump.

I'm testing the following patch:

diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index 141c935..9d6635b 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -3616,6 +3616,19 @@ maybe_tidy_empty_bb (basic_block bb, bool
recompute_toporder_p)
               rescan_p = true;
               break;
             }
+      else if (single_succ_p (pred_bb) && any_condjump_p (BB_END (pred_bb)))
+        {
+          if (INSN_SCHED_TIMES (BB_END (pred_bb)) == 0
+          && !IN_CURRENT_FENCE_P (BB_END (pred_bb)))
+        {
+          if (!sel_remove_insn (BB_END (pred_bb), false, false))
+            tidy_fallthru_edge (e);
+        }
+          else
+        sel_redirect_edge_and_branch (e, succ_bb);
+          rescan_p = true;
+          break;
+        }
         }
     }

Reply via email to