This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/42245] ICE in verify_backedges for 197.parser with sel-sched



------- Comment #3 from abel at gcc dot gnu dot org  2009-12-28 12:06 -------
The patch mentioned by Alexander is not enough to fix the bug after applying
all other patches for sel-sched bugs.  The actual problem is that when
redirecting an edge, the topological order of blocks in the currently
scheduling region may be broken.  I had a patch to fix this, but didn't apply
it to trunk so got beaten by it.  We will post it shortly.

        * sel-sched-ir.c (sel_redirect_edge_and_branch): Recompute
        topological order after redirecting an edge if needed.

diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index 645093a..2baa461 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -5394,6 +5394,27 @@ sel_redirect_edge_and_branch (edge e, basic_block to)
       gcc_assert (loop_latch_edge (current_loop_nest));
     }

+  /* In rare situations, the topological relation between the blocks connected
+     by the redirected edge can change.  Update block_to_bb/bb_to_block.  */
+  if (CONTAINING_RGN (e->src->index) == CONTAINING_RGN (to->index)
+      && BLOCK_TO_BB (e->src->index) > BLOCK_TO_BB (to->index))
+    {
+      int i, n, rgn;
+      int *postorder, n_blocks;
+
+      postorder = XALLOCAVEC (int, n_basic_blocks);
+      n_blocks = post_order_compute (postorder, false, false);
+
+      rgn = CONTAINING_RGN (e->src->index);
+      for (n = 0, i = n_blocks - 1; i >= 0; i--)
+        if (CONTAINING_RGN (postorder[i]) == rgn)
+          {
+            BLOCK_TO_BB (postorder[i]) = n;
+            BB_TO_BLOCK (n) = postorder[i];
+            n++;
+          }
+    }
+
   jump = find_new_jump (src, NULL, prev_max_uid);
   if (jump)
     sel_init_new_insn (jump, INSN_INIT_TODO_LUID | INSN_INIT_TODO_SIMPLEJUMP);


-- 

abel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |abel at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]