haifa-sched.cc:remove_notes asserts that it lands on a real (non-note) insn after advancing past NOTE_INSN_EPILOGUE_BEG, but with the upcoming post-RA aarch64 load pair pass enabled, we can land on NOTE_INSN_DELETED.
This patch adjusts remove_notes to remove these if they occur at the start of the epilogue instead of asserting. Bootstrapped/regtested as a series on aarch64-linux-gnu, OK for trunk? gcc/ChangeLog: * haifa-sched.cc (remove_notes): Allow for NOTE_INSN_DELETED at the start of the epilgoue, remove these. --- gcc/haifa-sched.cc | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/gcc/haifa-sched.cc b/gcc/haifa-sched.cc index 8e8add709b3..9f45528fbe9 100644 --- a/gcc/haifa-sched.cc +++ b/gcc/haifa-sched.cc @@ -4249,6 +4249,17 @@ remove_notes (rtx_insn *head, rtx_insn *tail) && NOTE_KIND (next) == NOTE_INSN_BASIC_BLOCK && next != next_tail) next = NEXT_INSN (next); + + /* Skip over any NOTE_INSN_DELETED at the start of the epilogue. + */ + while (NOTE_P (next) + && NOTE_KIND (next) == NOTE_INSN_DELETED) + { + auto tmp = NEXT_INSN (next); + delete_insn (next); + next = tmp; + } + gcc_assert (INSN_P (next)); add_reg_note (next, REG_SAVE_NOTE, GEN_INT (NOTE_INSN_EPILOGUE_BEG));