jump.c (onlyjump_p): New function.
authorRichard Henderson <rth@cygnus.com>
Sat, 7 Aug 1999 18:36:15 +0000 (11:36 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Sat, 7 Aug 1999 18:36:15 +0000 (11:36 -0700)
        * jump.c (onlyjump_p): New function.
        * rtl.h: Declare it.
        * flow.c (delete_unreachable_blocks): Use onlyjump_p instead
        of condjump_p in calling tidy_fallthru_edge and merge_blocks.

From-SVN: r28584

gcc/ChangeLog
gcc/flow.c
gcc/jump.c
gcc/rtl.h

index d3715d620a3ae7da53ce84a49cd4d5dec16dd22d..2a6b9b6d3a254d1eb889b1b9c0c87d49ef978b1e 100644 (file)
@@ -1,3 +1,10 @@
+Sat Aug  7 19:32:16 1999  Richard Henderson  <rth@cygnus.com>
+
+       * jump.c (onlyjump_p): New function.
+       * rtl.h: Declare it.
+       * flow.c (delete_unreachable_blocks): Use onlyjump_p instead
+       of condjump_p in calling tidy_fallthru_edge and merge_blocks.
+
 Sat Aug  7 17:09:36 1999  Richard Henderson  <rth@cygnus.com>
 
        * global.c (build_insn_chain): Use EXECUTE_IF_SET_IN_REG_SET
index 9ca8f5c88fb053a2da4a73c836e092f17f585168..0fbe5517a597f36001244d532163daa2b1b620af 100644 (file)
@@ -1564,11 +1564,9 @@ delete_unreachable_blocks ()
       if ((s = b->succ) != NULL
          && s->succ_next == NULL
          && s->dest == c
-         /* If the last insn is not a normal conditional jump
-            (or an unconditional jump), then we can not tidy the
-            fallthru edge because we can not delete the jump.  */
-         && GET_CODE (b->end) == JUMP_INSN
-         && condjump_p (b->end))
+         /* If the jump insn has side effects, we can't tidy the edge.  */
+         && (GET_CODE (b->end) != JUMP_INSN
+             || onlyjump_p (b->end)))
        tidy_fallthru_edge (s, b, c);
     }
 
@@ -1587,11 +1585,9 @@ delete_unreachable_blocks ()
             && (s->flags & EDGE_EH) == 0
             && (c = s->dest) != EXIT_BLOCK_PTR
             && c->pred->pred_next == NULL
-            /* If the last insn is not a normal conditional jump
-               (or an unconditional jump), then we can not merge
-               the blocks because we can not delete the jump.  */
-            && GET_CODE (b->end) == JUMP_INSN
-            && condjump_p (b->end)
+            /* If the jump insn has side effects, we can't kill the edge.  */
+            && (GET_CODE (b->end) != JUMP_INSN
+                || onlyjump_p (b->end))
             && merge_blocks (s, b, c))
        continue;
 
index 37298f038b3a5854833de0eff93a38b4d3798889..71811bb9f8b6217f5c09db963cca674d739cfbfc 100644 (file)
@@ -3528,6 +3528,29 @@ returnjump_p (insn)
   return for_each_rtx (&PATTERN (insn), returnjump_p_1, NULL);
 }
 
+/* Return true if INSN is a jump that only transfers control and
+   nothing more.  */
+
+int
+onlyjump_p (insn)
+     rtx insn;
+{
+  rtx set;
+
+  if (GET_CODE (insn) != JUMP_INSN)
+    return 0;
+
+  set = single_set (insn);
+  if (set == NULL)
+    return 0;
+  if (GET_CODE (SET_DEST (set)) != PC)
+    return 0;
+  if (side_effects_p (SET_SRC (set)))
+    return 0;
+
+  return 1;
+}
+
 #ifdef HAVE_cc0
 
 /* Return 1 if X is an RTX that does nothing but set the condition codes
index 9b86a84e75b01d68e5302d4877c458654da3a7b7..a0bd720e2fbdd3b1cc3143fc2d97c7e399b563ba 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1352,6 +1352,7 @@ extern int condjump_p                     PROTO ((rtx));
 extern rtx condjump_label              PROTO ((rtx));
 extern int simplejump_p                        PROTO ((rtx));
 extern int returnjump_p                        PROTO ((rtx));
+extern int onlyjump_p                  PROTO ((rtx));
 extern int sets_cc0_p                  PROTO ((rtx));
 extern int invert_jump                 PROTO ((rtx, rtx));
 extern int rtx_renumbered_equal_p      PROTO ((rtx, rtx));