flow.c (propagate_block): When the last reference to a label before an ADDR_VEC is...
authorGeoff Keating <geoffk@cygnus.com>
Thu, 28 Oct 1999 20:37:37 +0000 (20:37 +0000)
committerGeoffrey Keating <geoffk@gcc.gnu.org>
Thu, 28 Oct 1999 20:37:37 +0000 (20:37 +0000)
* flow.c (propagate_block): When the last reference to a label
before an ADDR_VEC is deleted because the reference is a dead
store, delete the ADDR_VEC.

From-SVN: r30247

gcc/ChangeLog
gcc/flow.c

index 5595acc33fb754cbdc19feeeb9a1007882d5bf28..97e54f562c0b5d8591b48fa1475b098b4d480e4f 100644 (file)
@@ -1,3 +1,9 @@
+Fri Oct 29 06:32:44 1999  Geoffrey Keating  <geoffk@cygnus.com>
+
+       * flow.c (propagate_block): When the last reference to a label
+       before an ADDR_VEC is deleted because the reference is a dead
+       store, delete the ADDR_VEC.
+
 Thu Oct 28 12:28:50 1999  Richard Henderson  <rth@cygnus.com>
 
        * resource.c (find_free_register): Don't use the frame pointer
index 9ce099fbc11c2917cb8553873b986d8281b88797..8758ea81cd0278b992f938334bf361c83b0f7aa5 100644 (file)
@@ -3321,6 +3321,40 @@ propagate_block (old, first, last, significant, bnum, flags)
             can cause trouble for first or last insn in a basic block.  */
          if ((flags & PROP_KILL_DEAD_CODE) && insn_is_dead)
            {
+             rtx inote;
+             /* If the insn referred to a label, note that the label is
+                now less used.  */
+             for (inote = REG_NOTES (insn); inote; inote = XEXP (inote, 1))
+               {
+                 if (REG_NOTE_KIND (inote) == REG_LABEL)
+                   {
+                     rtx label = XEXP (inote, 0);
+                     rtx next;
+                     LABEL_NUSES (label)--;
+
+                     /* If this label was attached to an ADDR_VEC, it's
+                        safe to delete the ADDR_VEC.  In fact, it's pretty much
+                        mandatory to delete it, because the ADDR_VEC may
+                        be referencing labels that no longer exist.  */
+                     if (LABEL_NUSES (label) == 0
+                         && (next = next_nonnote_insn (label)) != NULL
+                         && GET_CODE (next) == JUMP_INSN
+                         && (GET_CODE (PATTERN (next)) == ADDR_VEC
+                             || GET_CODE (PATTERN (next)) == ADDR_DIFF_VEC))
+                       {
+                         rtx pat = PATTERN (next);
+                         int diff_vec_p = GET_CODE (pat) == ADDR_DIFF_VEC;
+                         int len = XVECLEN (pat, diff_vec_p);
+                         int i;
+                         for (i = 0; i < len; i++)
+                           LABEL_NUSES (XEXP (XVECEXP (pat, diff_vec_p, i), 0))--;
+                         PUT_CODE (next, NOTE);
+                         NOTE_LINE_NUMBER (next) = NOTE_INSN_DELETED;
+                         NOTE_SOURCE_FILE (next) = 0;
+                       }
+                   }
+               }
+
              PUT_CODE (insn, NOTE);
              NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
              NOTE_SOURCE_FILE (insn) = 0;