------- Comment #1 from abel at gcc dot gnu dot org 2009-12-24 08:32 ------- Here, we broke pipelining of outer loops when optimizing the scheduler core. The problems analyzed by Alexander are simple though. First, when testing whether a loop is considered for pipelining, I decided to play safe and also check pipelining_p in addition to the flag in the aux loop data that was designed specially for this. Naturally, when we then disabled pipelining_p for rescheduling pipelined loops, this broke, so to fix it we just need to stop checking for pipelining_p. The second problem is that we use the last_added_blocks vector when adding blocks to the region, and we failed to initialize it correctly for the case of moving preheader blocks from an inner loop to an outer loop when we have added the vector. Also easily fixed via correctly initializing the vector.
Again, we would ask someone with access to ppc/ppc64 to test this patch as a part of the combined patch with fixes for all sel-sched bugs, when our testing will be completed. This patch also fixes PR39453. * sel-sched-ir.c (considered_for_pipelining_p): Do not test for pipelining_p. (sel_add_loop_preheaders): Add preheader to last_added_blocks. --- gcc/sel-sched-ir.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c index 2469822..3c2989a 100644 --- a/gcc/sel-sched-ir.c +++ b/gcc/sel-sched-ir.c @@ -5825,7 +5825,7 @@ considered_for_pipelining_p (struct loop *loop) latch. We can't use header here, because this header could be just removed preheader and it will give us the wrong region number. Latch can't be used because it could be in the inner loop too. */ - if (LOOP_MARKED_FOR_PIPELINING_P (loop) && pipelining_p) + if (LOOP_MARKED_FOR_PIPELINING_P (loop)) { int rgn = CONTAINING_RGN (loop->latch->index); @@ -5974,7 +5974,10 @@ sel_add_loop_preheaders (void) for (i = 0; VEC_iterate (basic_block, preheader_blocks, i, bb); i++) + { + VEC_safe_push (basic_block, heap, last_added_blocks, bb); sel_add_bb (bb); + } VEC_free (basic_block, heap, preheader_blocks); } -- abel at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |abel at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42246