From e6836d7e9a181e2f792f06aaff6257012e51170d Mon Sep 17 00:00:00 2001 From: kenner Date: Fri, 15 Sep 1995 21:39:39 +0000 Subject: [PATCH] (fill_simple_delay_slots): When filling an insn's delay slot with a JUMP_INSN, don't assume the JUMP_INSN immediately follows the insn on the unfilled slots obstack. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@10362 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/reorg.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/gcc/reorg.c b/gcc/reorg.c index 00e860ce087..edd76d5d21b 100644 --- a/gcc/reorg.c +++ b/gcc/reorg.c @@ -2857,12 +2857,24 @@ fill_simple_delay_slots (first, non_jumps_p) && eligible_for_delay (insn, slots_filled, trial, flags) && no_labels_between_p (insn, trial)) { + rtx *tmp; slots_filled++; delay_list = add_to_delay_list (trial, delay_list); + + /* TRIAL may have had its delay slot filled, then unfilled. When + the delay slot is unfilled, TRIAL is placed back on the unfilled + slots obstack. Unfortunately, it is placed on the end of the + obstack, not in its original location. Therefore, we must search + from entry i + 1 to the end of the unfilled slots obstack to + try and find TRIAL. */ + tmp = &unfilled_slots_base[i + 1]; + while (*tmp != trial && tmp != unfilled_slots_next) + tmp++; + /* Remove the unconditional jump from consideration for delay slot - filling and unthread it. */ - if (unfilled_slots_base[i + 1] == trial) - unfilled_slots_base[i + 1] = 0; + filling and unthread it. */ + if (*tmp == trial) + *tmp = 0; { rtx next = NEXT_INSN (trial); rtx prev = PREV_INSN (trial); -- 2.11.0