From: geoffk Date: Thu, 28 Oct 1999 20:37:37 +0000 (+0000) Subject: * flow.c (propagate_block): When the last reference to a label X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=00c4bf46719d2536f457c081795bdc280e1c7cce;p=platform%2Fupstream%2Flinaro-gcc.git * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30247 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5595acc..97e54f5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +Fri Oct 29 06:32:44 1999 Geoffrey Keating + + * 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 * resource.c (find_free_register): Don't use the frame pointer diff --git a/gcc/flow.c b/gcc/flow.c index 9ce099f..8758ea8 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -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;