My concern is more about calling NEXT_INSN on a deleted insn. If
that's guaranteed to be "reliable", I'm OK with it.
Alternately, call NEXT_INSN at the top of the loop, but save the value
until the *next* iteration of the loop, so we can delete the insn and
not have to call NEXT_INSN on it after being deleted.
next_insn = get_insns ();
while (next_insn)
{
insn = next_insn;
next_insn = NEXT_INSN (insn);
. . .
}
Of course, *that* assumes that we never delete more than just the one
"insn" we're processing. In that case, though, we could still just
update next_insn so the next loop gets the right one.
So pick whichever solution is more future-proof and go for it :-)