------- Comment #3 from abel at gcc dot gnu dot org  2009-12-24 07:39 -------
The problem was that the failing assert is actually too strict, when an empty
block is removed, its predecessor could be outside the region.  After fixing
this, I have also further robustified the function to expect empty blocks with
no succs or preds, as this problem showed itself yet another time via the
single failed test of the patch on ia64. 

        * sel-sched-ir.c (maybe_tidy_empty_bb): Do not delete empty blocks
        that have no predecessors nor successors.  Do not call move_bb_info
        for empty blocks outside of current region.
---
 gcc/sel-sched-ir.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index 3c2989a..0950f2a 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -3519,12 +3519,15 @@ maybe_tidy_empty_bb (basic_block bb)
   bool rescan_p;

   /* Keep empty bb only if this block immediately precedes EXIT and
-     has incoming non-fallthrough edge.  Otherwise remove it.  */
+     has incoming non-fallthrough edge, or it has no predecessors or
+     successors.  Otherwise remove it.  */
   if (!sel_bb_empty_p (bb)
       || (single_succ_p (bb)
           && single_succ (bb) == EXIT_BLOCK_PTR
           && (!single_pred_p (bb)
-              || !(single_pred_edge (bb)->flags & EDGE_FALLTHRU))))
+              || !(single_pred_edge (bb)->flags & EDGE_FALLTHRU)))
+      || EDGE_COUNT (bb->preds) == 0
+      || EDGE_COUNT (bb->succs) == 0)
     return false;

   /* Do not attempt to redirect complex edges.  */
@@ -3574,7 +3577,8 @@ maybe_tidy_empty_bb (basic_block bb)
     {
       gcc_assert (pred_bb != NULL);

-      move_bb_info (pred_bb, bb);
+      if (in_current_region_p (pred_bb))
+       move_bb_info (pred_bb, bb);
       remove_empty_bb (bb, true);
     }



-- 

abel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |abel at gcc dot gnu dot org,
                   |                            |amonakov at gcc dot gnu dot
                   |                            |org
         AssignedTo|unassigned at gcc dot gnu   |abel at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-12-24 07:39:24
               date|                            |


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

Reply via email to