* jump.c (delete_insn): Delete the addr_vec when deleting a tablejump.
authorRichard Henderson <rth@cygnus.com>
Wed, 4 Aug 1999 08:19:36 +0000 (01:19 -0700)
committerJeff Law <law@gcc.gnu.org>
Wed, 4 Aug 1999 08:19:36 +0000 (02:19 -0600)
From-SVN: r28492

gcc/ChangeLog
gcc/jump.c

index b17ccd33860290eeae43462577234b892a9d3fa9..a28bc6953d8b7d69fef18e29256b27fe24939600 100644 (file)
@@ -1,3 +1,7 @@
+Wed Aug  4 02:15:32 1999  Richard Henderson <rth@cygnus.com>
+
+       * jump.c (delete_insn): Delete the addr_vec when deleting a tablejump.
+
 Wed Aug  4 01:48:08 1999  Jim Kingdon  <http://developer.redhat.com>
 
        * global.c: Fix comment.
index 295a6c117ba64fad8b18f85b07c13e6547b9a204..da81b5a6d4469adbaa103fd837b83499f96f774a 100644 (file)
@@ -4017,20 +4017,36 @@ delete_insn (insn)
      and delete the label if it is now unused.  */
 
   if (GET_CODE (insn) == JUMP_INSN && JUMP_LABEL (insn))
-    if (--LABEL_NUSES (JUMP_LABEL (insn)) == 0)
-      {
-       /* This can delete NEXT or PREV,
-          either directly if NEXT is JUMP_LABEL (INSN),
-          or indirectly through more levels of jumps.  */
-       delete_insn (JUMP_LABEL (insn));
-       /* I feel a little doubtful about this loop,
-          but I see no clean and sure alternative way
-          to find the first insn after INSN that is not now deleted.
-          I hope this works.  */
-       while (next && INSN_DELETED_P (next))
-         next = NEXT_INSN (next);
-       return next;
-      }
+    {
+      rtx lab = JUMP_LABEL (insn), lab_next;
+
+      if (--LABEL_NUSES (lab) == 0)
+       {
+         /* This can delete NEXT or PREV,
+            either directly if NEXT is JUMP_LABEL (INSN),
+            or indirectly through more levels of jumps.  */
+         delete_insn (lab);
+
+         /* I feel a little doubtful about this loop,
+            but I see no clean and sure alternative way
+            to find the first insn after INSN that is not now deleted.
+            I hope this works.  */
+         while (next && INSN_DELETED_P (next))
+           next = NEXT_INSN (next);
+         return next;
+       }
+      else if ((lab_next = next_nonnote_insn (lab)) != NULL
+              && GET_CODE (lab_next) == JUMP_INSN
+              && (GET_CODE (PATTERN (lab_next)) == ADDR_VEC
+                  || GET_CODE (PATTERN (lab_next)) == ADDR_DIFF_VEC))
+       {
+         /* If we're deleting the tablejump, delete the dispatch table.
+            We may not be able to kill the label immediately preceeding
+            just yet, as it might be referenced in code leading up to
+            the tablejump.  */
+         delete_insn (lab_next);
+       }
+    }
 
   /* Likewise if we're deleting a dispatch table.  */