This is the mail archive of the gcc-patches@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]

fix execute/comp-goto-2.c


The problem here is that we have

(jump_insn 40 39 41 (set (pc)
        (mem:SI (plus:SI (reg:SI 2 ecx [59])
                (const_int -4 [0xfffffffc])) [0 S4 A32]))
	503 {*indirect_jump} (nil)
    (expr_list:REG_DEAD (reg:SI 2 ecx [59])
        (expr_list:REG_NON_LOCAL_GOTO (const_int 0 [0x0])
            (nil))))

being matched with
 
(jump_insn 77 76 78 (return) -1 (nil)
    (nil))

because they both have an edge to EXIT.  Unfortunately the former
is a fake edge added by add_noreturn_fake_exit_edges.  So we have
to check a bit more than matching the existance of a single edge.


r~


        * cfgcleanup.c (outgoing_edges_match): Check for insn match with
        a single outgoing edge too.

Index: cfgcleanup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgcleanup.c,v
retrieving revision 1.24
diff -u -p -r1.24 cfgcleanup.c
--- cfgcleanup.c	2001/12/15 04:12:41	1.24
+++ cfgcleanup.c	2001/12/17 18:09:56
@@ -776,11 +776,14 @@ outgoing_edges_match (mode, bb1, bb2)
   edge fallthru1 = 0, fallthru2 = 0;
   edge e1, e2;
 
-  /* If BB1 has only one successor, we must be looking at an unconditional
-     jump.  Which, by the assumption above, means that we only need to check
-     that BB2 has one successor.  */
+  /* If BB1 has only one successor, we may be looking at either an
+     unconditional jump, or a fake edge to exit.  */
   if (bb1->succ && !bb1->succ->succ_next)
-    return (bb2->succ && !bb2->succ->succ_next);
+    {
+      if (! bb2->succ || bb2->succ->succ_next)
+	return false;
+      return insns_match_p (mode, bb1->end, bb2->end);
+    }
 
   /* Match conditional jumps - this may get tricky when fallthru and branch
      edges are crossed.  */


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