Hi DJ,
My concern is more about calling NEXT_INSN on a deleted insn. If
that's guaranteed to be "reliable", I'm OK with it.
So pick whichever solution is more future-proof and go for it :-)
OK, I have gone with the following. I have replaced NEXT_INSN with
next_nonnote_nondebug_insn, so that we are sure that we are dealing with
a valid potential insn for removal. We do not have to worry about
calling this on a deleted insn because we know that delete_insn() will
only be called on a single set insn, and that deleting it will only
remove that insn and not any others that follow it.
Whilst doing this I noticed that follow might be set incorrectly (to a
debug insn), so I fixed that as well.
Cheers
Nick
gcc/ChangeLog
2012-07-03 Nick Clifton <ni...@redhat.com>
* config/mep/mep.c (mep_reorg_regmove): Use
next_nonnote_non_debug_insn to advance to the next insn. Do not
expect delete_insn to return an rtx.
Index: gcc/config/mep/mep.c
===================================================================
--- gcc/config/mep/mep.c (revision 189193)
+++ gcc/config/mep/mep.c (working copy)
@@ -5022,7 +5022,7 @@
done = 1;
for (insn = insns; insn; insn = next)
{
- next = NEXT_INSN (insn);
+ next = next_nonnote_nondebug_insn (insn);
if (GET_CODE (insn) != INSN)
continue;
pat = PATTERN (insn);
@@ -5035,7 +5035,7 @@
&& find_regno_note (insn, REG_DEAD, REGNO (SET_SRC (pat)))
&& mep_compatible_reg_class (REGNO (SET_SRC (pat)), REGNO
(SET_DEST (pat))))
{
- follow = next_nonnote_insn (insn);
+ follow = next_nonnote_nondebug_insn (insn);
if (dump_file)
fprintf (dump_file, "superfluous moves: considering %d\n", INSN_UID
(insn));
@@ -5096,7 +5096,7 @@
follow, where))
{
count ++;
- next = delete_insn (insn);
+ delete_insn (insn);
if (dump_file)
{
fprintf (dump_file, "\n----- Success! new insn:\n\n");