diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5e3821ce5ffb1f38fba2acce08a7423c7e445976..f25661a6025d0ea496b1a9e17fcb86cc68d11d88 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2001-01-01 John David Anglin <dave@hiauly1.hia.nrc.ca> + + * loop.c (add_label_notes): Increment the label usage count when + a note is added to an insn which refers to a CODE_LABEL. + * gcse.c (add_label_notes): Likewise. + 2001-01-01 Andreas Jaeger <aj@suse.de> * loop.c (scan_loop): Use xmalloc to allocate movables. diff --git a/gcc/gcse.c b/gcc/gcse.c index 73f49f3ce88f8f19a910b88bf82121074f71ce73..f423c5ec27d7d2971d80741515f091dac91b575f 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -1,6 +1,6 @@ /* Global common subexpression elimination/Partial redundancy elimination and global constant/copy propagation for GNU compiler. - Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GNU CC. @@ -4839,8 +4839,9 @@ one_pre_gcse_pass (pass) } /* If X contains any LABEL_REF's, add REG_LABEL notes for them to INSN. - We have to add REG_LABEL notes, because the following loop optimization - pass requires them. */ + If notes are added to an insn which references a CODE_LABEL, the + LABEL_NUSES count is incremented. We have to add REG_LABEL notes, + because the following loop optimization pass requires them. */ /* ??? This is very similar to the loop.c add_label_notes function. We could probably share code here. */ @@ -4868,6 +4869,8 @@ add_label_notes (x, insn) REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_LABEL, XEXP (x, 0), REG_NOTES (insn)); + if (LABEL_P (XEXP (x, 0))) + LABEL_NUSES (XEXP (x, 0))++; return; } diff --git a/gcc/loop.c b/gcc/loop.c index 8faacaf3e02054f84d641ae45f69379f8c6fea83..a504ed65c885934c18ed0810793ed40eda3ca009 100644 --- a/gcc/loop.c +++ b/gcc/loop.c @@ -1594,7 +1594,8 @@ rtx_equal_for_loop_p (x, y, movables, regs) } /* If X contains any LABEL_REF's, add REG_LABEL notes for them to all - insns in INSNS which use the reference. */ + insns in INSNS which use the reference. LABEL_NUSES for CODE_LABEL + references is incremented once for each added note. */ static void add_label_notes (x, insns) @@ -1615,8 +1616,12 @@ add_label_notes (x, insns) mark_jump_label for additional information). */ for (insn = insns; insn; insn = NEXT_INSN (insn)) if (reg_mentioned_p (XEXP (x, 0), insn)) - REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_LABEL, XEXP (x, 0), - REG_NOTES (insn)); + { + REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_LABEL, XEXP (x, 0), + REG_NOTES (insn)); + if (LABEL_P (XEXP (x, 0))) + LABEL_NUSES (XEXP (x, 0))++; + } } fmt = GET_RTX_FORMAT (code);