Message ID | 5306FEC9.50501@ispras.ru |
---|---|
State | New |
Headers | show |
On 2/21/2014, 2:22 AM, Andrey Belevantsev wrote: > Hello, > > While fixing PR 58960 I forgot about single-block regions placing the > initialization of the new nr_regions_initial variable in the wrong > place. Thus for single block regions we ended up with nr_regions = 1 and > nr_regions_initial = 0 and effectively turned off sched-pressure > immediately. No worries for the usual scheduling path but with the > -flive-range-shrinkage we have broke an assert that sched-pressure is in > the specific mode. > > Fixed by placing the initialization properly at the end of > sched_rgn_init and also moving the check for sched_pressure != NONE > outside of the if statement in schedule_region as discussed in the PR > trail with Jakub. > > Bootstrapped and tested on x86-64, ok? > > Ok. Thanks, Andrey. > 2014-02-21 Andrey Belevantsev <abel@ispras.ru> > > PR rtl-optimization/60268 > * sched-rgn.c (haifa_find_rgns): Move the nr_regions_initial init > to ... > (sched_rgn_init) ... here. > (schedule_region): Check for SCHED_PRESSURE_NONE earlier. > > testsuite/ > > 2014-02-21 Andrey Belevantsev <abel@ispras.ru> > > PR rtl-optimization/60268 > * gcc.c-torture/compile/pr60268.c: New test.
Andrey Belevantsev <abel@ispras.ru> writes: > Fixed by placing the initialization properly at the end of sched_rgn_init > and also moving the check for sched_pressure != NONE outside of the if > statement in schedule_region as discussed in the PR trail with Jakub. > > Bootstrapped and tested on x86-64, ok? This breaks m68k: $ gcc/xgcc -Bgcc/ -fno-diagnostics-show-caret -fdiagnostics-color=never -O0 -flive-range-shrinkage -c -o pr60268.o ../gcc/testsuite/gcc.c-torture/compile/pr60268.c ../gcc/testsuite/gcc.c-torture/compile/pr60268.c: In function âfâ: ../gcc/testsuite/gcc.c-torture/compile/pr60268.c:6:1: internal compiler error: in m68k_sched_issue_rate, at config/m68k/m68k.c:5978 0xbabc8b m68k_sched_issue_rate ../../gcc/config/m68k/m68k.c:5978 0xc3d9dc sched_init() ../../gcc/haifa-sched.c:6657 0xc3eecf haifa_sched_init() ../../gcc/haifa-sched.c:6719 0x8e807c schedule_insns ../../gcc/sched-rgn.c:3407 0x8e87cb schedule_insns ../../gcc/sched-rgn.c:3401 0x8e87cb rest_of_handle_live_range_shrinkage ../../gcc/sched-rgn.c:3614 0x8e87cb execute ../../gcc/sched-rgn.c:3704 Andreas.
diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c index 0573b6a..dc6fa16 100644 --- a/gcc/sched-rgn.c +++ b/gcc/sched-rgn.c @@ -1067,7 +1067,6 @@ haifa_find_rgns (void) BLOCK_TO_BB (bb->index) = 0; } - nr_regions_initial = nr_regions; free (max_hdr); free (degree); free (stack); @@ -2997,10 +2996,10 @@ schedule_region (int rgn) /* Do not support register pressure sensitive scheduling for the new regions as we don't update the liveness info for them. */ - if (rgn >= nr_regions_initial) + if (sched_pressure != SCHED_PRESSURE_NONE + && rgn >= nr_regions_initial) { - if (sched_pressure != SCHED_PRESSURE_NONE) - free_global_sched_pressure_data (); + free_global_sched_pressure_data (); sched_pressure = SCHED_PRESSURE_NONE; } @@ -3166,6 +3165,7 @@ sched_rgn_init (bool single_blocks_p) RGN_BLOCKS (nr_regions) = (RGN_BLOCKS (nr_regions - 1) + RGN_NR_BLOCKS (nr_regions - 1)); + nr_regions_initial = nr_regions; } /* Free data structures for region scheduling. */ diff --git a/gcc/testsuite/gcc.c-torture/compile/pr60268.c b/gcc/testsuite/gcc.c-torture/compile/pr60268.c new file mode 100644 index 0000000..c3a6f94 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr60268.c @@ -0,0 +1,6 @@ +/* { dg-options "-flive-range-shrinkage" } */ +void f() +{ + int i = 0; + void *p = 0; +}