flow.c (tidy_fallthru_edge): Be more careful finding the last BARRIER of a list.
authorRichard Henderson <rth@cygnus.com>
Tue, 9 Mar 1999 15:49:53 +0000 (07:49 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Tue, 9 Mar 1999 15:49:53 +0000 (07:49 -0800)
* flow.c (tidy_fallthru_edge): Be more careful finding the last
BARRIER of a list.  Delete the cc0 setter as well as a cond jump.

From-SVN: r25656

gcc/ChangeLog
gcc/flow.c

index 2a5b2a99169c0a6c2d2f72b8a91c3801ac18c195..171d2eaebd55156ec1d2e045f82e31839045a069 100644 (file)
@@ -1,3 +1,8 @@
+Tue Mar  9 15:48:15 1999  Richard Henderson  <rth@cygnus.com>
+
+       * flow.c (tidy_fallthru_edge): Be more careful finding the last
+       BARRIER of a list.  Delete the cc0 setter as well as a cond jump.
+
 Tue Mar  9 15:26:02 1999  Hans-Peter Nilsson  <hp@bitrange.com>
 
        * i386.md (ashlsi3 splitter): Fix typo in last change.
index 3b4ef6e581d780f243f0d110e0d8ff3092af5e9b..1e17112208e248c1a3dcb7bcf32370d78f0cbf67 100644 (file)
@@ -1933,7 +1933,7 @@ tidy_fallthru_edge (e, b, c)
      edge e;
      basic_block b, c;
 {
-  rtx p, q, h;
+  rtx q, h;
 
   /* ??? In a late-running flow pass, other folks may have deleted basic
      blocks by nopping out blocks, leaving multiple BARRIERs between here
@@ -1943,12 +1943,10 @@ tidy_fallthru_edge (e, b, c)
      barriers and notes.  */
 
   q = NEXT_INSN (b->end);
-  do
-    {
-      p = q;
-      q = next_nonnote_insn (q);
-    }
-  while (GET_CODE (q) == BARRIER);
+  if (q && GET_CODE (q) == NOTE)
+    q = next_nonnote_insn (q);
+  while (q && GET_CODE (q) == BARRIER)
+    q = next_nonnote_insn (q);
 
   /* Assert that we now actually do fall through.  */
   h = c->head;
@@ -1963,6 +1961,13 @@ tidy_fallthru_edge (e, b, c)
   q = b->end;
   if (GET_CODE (q) == JUMP_INSN)
     {
+#ifdef HAVE_cc0
+      /* If this was a conditional jump, we need to also delete
+        the insn that set cc0.  */
+      if (! simplejump_p (q) && condjump_p (q))
+       q = PREV_INSN (q);
+#endif
+
       if (b->head == q)
        {
          PUT_CODE (q, NOTE);
@@ -1974,7 +1979,8 @@ tidy_fallthru_edge (e, b, c)
     }
 
   /* Selectively unlink the sequence.  */
-  delete_insn_chain (NEXT_INSN (q), p);
+  if (q != PREV_INSN (c->head))
+    delete_insn_chain (NEXT_INSN (q), PREV_INSN (c->head));
 
   e->flags |= EDGE_FALLTHRU;
 }