This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][ia64] fix rtl enable-check failure emit-rtl.c:reorder_insns.
- From: Graham Stott <graham dot stott at btinternet dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 31 May 2004 16:49:57 +0100
- Subject: [PATCH][ia64] fix rtl enable-check failure emit-rtl.c:reorder_insns.
All,
The attached patch fixes a rtl enable-check failure in emit-rtl.c:reorder_insns
The code was setting BB for a BARRIER insn which is wrong hence the abort.
I have only observed the abort doing a ia64 cross probably because ia64 makes more use of barriers
than other targets. I don't have access to an ia64 so I'm unable to do a full bootstrap and
check. The patch does allow a ia64 cross to get much further before failing on an unrelated issue.
I've done a full i686-pc-linux-gnu bootstrap all languages no regressions.
Note the patch is larger than absolutely necessary because I've taken the opportunity
to use BARRIER_P
Graham
ChangeLog
2004-05-31 Graham Stott <graham.stott@btinternet.com>
* emir-rtl.c(reorder_insns): Don't set BB for a BARRIER insn.
* emit-rtl.c(try_split): Use BARRIER_P
(add_insn_after): Likewise.
(add_insn_before): Likewise.
(remove_insn): Likewise.
(reorder_insns): Likewise.
(emit_insn_after_1): Likewise.
Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.393
diff -c -p -r1.393 emit-rtl.c
*** emit-rtl.c 28 May 2004 06:27:31 -0000 1.393
--- emit-rtl.c 31 May 2004 15:18:51 -0000
*************** try_split (rtx pat, rtx trial, int last)
*** 3245,3251 ****
/* If we are splitting a JUMP_INSN, it might be followed by a BARRIER.
We may need to handle this specially. */
! if (after && GET_CODE (after) == BARRIER)
{
has_barrier = 1;
after = NEXT_INSN (after);
--- 3245,3251 ----
/* If we are splitting a JUMP_INSN, it might be followed by a BARRIER.
We may need to handle this specially. */
! if (after && BARRIER_P (after))
{
has_barrier = 1;
after = NEXT_INSN (after);
*************** add_insn_after (rtx insn, rtx after)
*** 3529,3536 ****
abort ();
}
! if (GET_CODE (after) != BARRIER
! && GET_CODE (insn) != BARRIER
&& (bb = BLOCK_FOR_INSN (after)))
{
set_block_for_insn (insn, bb);
--- 3529,3536 ----
abort ();
}
! if (!BARRIER_P (after)
! && !BARRIER_P (insn)
&& (bb = BLOCK_FOR_INSN (after)))
{
set_block_for_insn (insn, bb);
*************** add_insn_after (rtx insn, rtx after)
*** 3540,3546 ****
either NOTE or LABEL. */
if (BB_END (bb) == after
/* Avoid clobbering of structure when creating new BB. */
! && GET_CODE (insn) != BARRIER
&& (GET_CODE (insn) != NOTE
|| NOTE_LINE_NUMBER (insn) != NOTE_INSN_BASIC_BLOCK))
BB_END (bb) = insn;
--- 3540,3546 ----
either NOTE or LABEL. */
if (BB_END (bb) == after
/* Avoid clobbering of structure when creating new BB. */
! && !BARRIER_P (insn)
&& (GET_CODE (insn) != NOTE
|| NOTE_LINE_NUMBER (insn) != NOTE_INSN_BASIC_BLOCK))
BB_END (bb) = insn;
*************** add_insn_before (rtx insn, rtx before)
*** 3597,3604 ****
abort ();
}
! if (GET_CODE (before) != BARRIER
! && GET_CODE (insn) != BARRIER
&& (bb = BLOCK_FOR_INSN (before)))
{
set_block_for_insn (insn, bb);
--- 3597,3604 ----
abort ();
}
! if (!BARRIER_P (before)
! && !BARRIER_P (insn)
&& (bb = BLOCK_FOR_INSN (before)))
{
set_block_for_insn (insn, bb);
*************** add_insn_before (rtx insn, rtx before)
*** 3608,3614 ****
either NOTE or LABEl. */
if (BB_HEAD (bb) == insn
/* Avoid clobbering of structure when creating new BB. */
! && GET_CODE (insn) != BARRIER
&& (GET_CODE (insn) != NOTE
|| NOTE_LINE_NUMBER (insn) != NOTE_INSN_BASIC_BLOCK))
abort ();
--- 3608,3614 ----
either NOTE or LABEl. */
if (BB_HEAD (bb) == insn
/* Avoid clobbering of structure when creating new BB. */
! && !BARRIER_P (insn)
&& (GET_CODE (insn) != NOTE
|| NOTE_LINE_NUMBER (insn) != NOTE_INSN_BASIC_BLOCK))
abort ();
*************** remove_insn (rtx insn)
*** 3676,3682 ****
if (stack == 0)
abort ();
}
! if (GET_CODE (insn) != BARRIER
&& (bb = BLOCK_FOR_INSN (insn)))
{
if (INSN_P (insn))
--- 3676,3682 ----
if (stack == 0)
abort ();
}
! if (!BARRIER_P (insn)
&& (bb = BLOCK_FOR_INSN (insn)))
{
if (INSN_P (insn))
*************** reorder_insns (rtx from, rtx to, rtx aft
*** 3774,3786 ****
reorder_insns_nobb (from, to, after);
! if (GET_CODE (after) != BARRIER
&& (bb = BLOCK_FOR_INSN (after)))
{
rtx x;
bb->flags |= BB_DIRTY;
! if (GET_CODE (from) != BARRIER
&& (bb2 = BLOCK_FOR_INSN (from)))
{
if (BB_END (bb2) == to)
--- 3774,3786 ----
reorder_insns_nobb (from, to, after);
! if (!BARRIER_P (after)
&& (bb = BLOCK_FOR_INSN (after)))
{
rtx x;
bb->flags |= BB_DIRTY;
! if (!BARRIER_P (from)
&& (bb2 = BLOCK_FOR_INSN (from)))
{
if (BB_END (bb2) == to)
*************** reorder_insns (rtx from, rtx to, rtx aft
*** 3792,3798 ****
BB_END (bb) = to;
for (x = from; x != NEXT_INSN (to); x = NEXT_INSN (x))
! set_block_for_insn (x, bb);
}
}
--- 3792,3799 ----
BB_END (bb) = to;
for (x = from; x != NEXT_INSN (to); x = NEXT_INSN (x))
! if (!BARRIER_P (x))
! set_block_for_insn (x, bb);
}
}
*************** emit_insn_after_1 (rtx first, rtx after)
*** 4148,4161 ****
rtx after_after;
basic_block bb;
! if (GET_CODE (after) != BARRIER
&& (bb = BLOCK_FOR_INSN (after)))
{
bb->flags |= BB_DIRTY;
for (last = first; NEXT_INSN (last); last = NEXT_INSN (last))
! if (GET_CODE (last) != BARRIER)
set_block_for_insn (last, bb);
! if (GET_CODE (last) != BARRIER)
set_block_for_insn (last, bb);
if (BB_END (bb) == after)
BB_END (bb) = last;
--- 4149,4162 ----
rtx after_after;
basic_block bb;
! if (!BARRIER_P (after)
&& (bb = BLOCK_FOR_INSN (after)))
{
bb->flags |= BB_DIRTY;
for (last = first; NEXT_INSN (last); last = NEXT_INSN (last))
! if (!BARRIER_P (last))
set_block_for_insn (last, bb);
! if (!BARRIER_P (last))
set_block_for_insn (last, bb);
if (BB_END (bb) == after)
BB_END (bb) = last;