This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix PR 40101
- From: Andrey Belevantsev <abel at ispras dot ru>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: "Vladimir N. Makarov" <vmakarov at redhat dot com>
- Date: Wed, 27 May 2009 11:57:27 +0400
- Subject: Fix PR 40101
Hello,
As explained in the PR audit trail, we hit a case when we cannot compute
a seqno for new bookkeeping insn just by looking at its preds/succs.
This means that we can assign arbitrary positive number as seqno, as
scheduling points (fences) would not get to this insn anyways, and it
would be safely picked up for rescheduling via existing logic. This can
only happen when pipelining.
I've tried to simplify the logic dealing with seqnos before writing this
patch, as explained in the PR, but decided that it cannot be done
without changing pipelining logic significantly. I will add to my TODO
list to check on this later.
Bootstrapped and tested on ia64 (with sel-sched enabled at -O2), the
patch fixes the spec test, and I've checked also that all other SPEC2k
tests look fine. I will try to distill a smaller test case, but I doubt
this is possible given five-digit UIDs.
OK for trunk?
Andrey
2009-05-27 Andrey Belevantsev <abel@ispras.ru>
PR rtl-optimization/40101
* sel-sched-ir.c (get_seqno_by_preds): Allow returning negative seqno.
Adjust comment.
* sel-sched.c (find_seqno_for_bookkeeping): Assert that when inserting
bookkeeping before a jump, the jump is not scheduled.
When no positive seqno found, provide a value. Add comment.
Index: gcc/sel-sched.c
===================================================================
*** gcc/sel-sched.c (revision 147558)
--- gcc/sel-sched.c (working copy)
*************** find_seqno_for_bookkeeping (insn_t place
*** 4524,4534 ****
if (INSN_P (next)
&& JUMP_P (next)
&& BLOCK_FOR_INSN (next) == BLOCK_FOR_INSN (place_to_insert))
! seqno = INSN_SEQNO (next);
else if (INSN_SEQNO (join_point) > 0)
seqno = INSN_SEQNO (join_point);
else
! seqno = get_seqno_by_preds (place_to_insert);
gcc_assert (seqno > 0);
return seqno;
--- 4524,4550 ----
if (INSN_P (next)
&& JUMP_P (next)
&& BLOCK_FOR_INSN (next) == BLOCK_FOR_INSN (place_to_insert))
! {
! gcc_assert (INSN_SCHED_TIMES (next) == 0);
! seqno = INSN_SEQNO (next);
! }
else if (INSN_SEQNO (join_point) > 0)
seqno = INSN_SEQNO (join_point);
else
! {
! seqno = get_seqno_by_preds (place_to_insert);
!
! /* Sometimes the fences can move in such a way that there will be
! no instructions with positive seqno around this bookkeeping.
! This means that there will be no way to get to it by a regular
! fence movement. Never mind because we pick up such pieces for
! rescheduling anyways, so any positive value will do for now. */
! if (seqno < 0)
! {
! gcc_assert (pipelining_p);
! seqno = 42;
! }
! }
gcc_assert (seqno > 0);
return seqno;
Index: gcc/sel-sched-ir.c
===================================================================
*** gcc/sel-sched-ir.c (revision 147558)
--- gcc/sel-sched-ir.c (working copy)
*************** get_seqno_of_a_pred (insn_t insn)
*** 3730,3736 ****
return seqno;
}
! /* Find the proper seqno for inserting at INSN. */
int
get_seqno_by_preds (rtx insn)
{
--- 3730,3737 ----
return seqno;
}
! /* Find the proper seqno for inserting at INSN. Returns -1 if no
predecessors
! with positive seqno exist. */
int
get_seqno_by_preds (rtx insn)
{
*************** get_seqno_by_preds (rtx insn)
*** 3749,3755 ****
for (i = 0, seqno = -1; i < n; i++)
seqno = MAX (seqno, INSN_SEQNO (preds[i]));
- gcc_assert (seqno > 0);
return seqno;
}
--- 3750,3755 ----