diff options
author | wilco <wilco@138bc75d-0d04-0410-961f-82ee72b054a4> | 2018-02-08 12:29:28 +0000 |
---|---|---|
committer | wilco <wilco@138bc75d-0d04-0410-961f-82ee72b054a4> | 2018-02-08 12:29:28 +0000 |
commit | 4327f0d4656abc1cdb54719702e00b15affef520 (patch) | |
tree | abee5c0888e2e05b7ff80a7f92572e3d6df3ecbf | |
parent | 0cbf4528a90dad3df520a632a89cb1596245533b (diff) | |
download | gcc-4327f0d4656abc1cdb54719702e00b15affef520.tar.gz |
PR84068, PR83459: Fix sort order of SCHED_PRESSURE_MODEL
The comparison function for SCHED_PRESSURE_MODEL is incorrect. If either
instruction is not in target_bb, the ordering is not well defined.
Since all instructions outside the target_bb get the highest model_index,
all we need to do is sort on model_index. If the model_index is the same
we defer to RFS_DEP_COUNT and/or RFS_TIE.
gcc/
PR rtl-optimization/84068
PR rtl-optimization/83459
* haifa-sched.c (rank_for_schedule): Fix SCHED_PRESSURE_MODEL sorting.
gcc/testsuite
PR rtl-optimization/84068
PR rtl-optimization/83459
* gcc.dg/pr84068.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@257481 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/haifa-sched.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr84068.c | 18 |
4 files changed, 33 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 84bf970575b..c9a9fdb745e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-02-08 Wilco Dijkstra <wdijkstr@arm.com> + + PR rtl-optimization/84068 + PR rtl-optimization/83459 + * haifa-sched.c (rank_for_schedule): Fix SCHED_PRESSURE_MODEL sorting. + 2018-02-08 Aldy Hernandez <aldyh@redhat.com> PR tree-optimization/84224 diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index ebdec46bf04..4a899b56173 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -2783,12 +2783,11 @@ rank_for_schedule (const void *x, const void *y) } /* Prefer instructions that occur earlier in the model schedule. */ - if (sched_pressure == SCHED_PRESSURE_MODEL - && INSN_BB (tmp) == target_bb && INSN_BB (tmp2) == target_bb) + if (sched_pressure == SCHED_PRESSURE_MODEL) { diff = model_index (tmp) - model_index (tmp2); - gcc_assert (diff != 0); - return rfs_result (RFS_PRESSURE_INDEX, diff, tmp, tmp2); + if (diff != 0) + return rfs_result (RFS_PRESSURE_INDEX, diff, tmp, tmp2); } /* Prefer the insn which has more later insns that depend on it. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7179728ed5a..c2eb50f453c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2018-02-08 Wilco Dijkstra <wdijkstr@arm.com> + + PR rtl-optimization/84068 + PR rtl-optimization/83459 + * gcc.dg/pr84068.c: New test. + 2018-02-08 Richard Biener <rguenther@suse.de> * g++.dg/vect/slp-pr56812.cc: Allow either basic-block or diff --git a/gcc/testsuite/gcc.dg/pr84068.c b/gcc/testsuite/gcc.dg/pr84068.c new file mode 100644 index 00000000000..13110d84455 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr84068.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-sched-critical-path-heuristic -fno-sched-rank-heuristic --param=max-sched-extend-regions-iters=5 --param sched-pressure-algorithm=2" } */ + +#ifdef __SIZEOF_INT128__ +typedef __int128 largeint; +#else +typedef long long largeint; +#endif + +largeint a; +int b; + +largeint +foo (char d, short e, int f) +{ + b = __builtin_sub_overflow_p (b, 1, (unsigned long)0); + return a + f; +} |