diff options
author | Wilco Dijkstra <wdijkstr@arm.com> | 2018-02-08 12:29:28 +0000 |
---|---|---|
committer | Wilco Dijkstra <wilco@gcc.gnu.org> | 2018-02-08 12:29:28 +0000 |
commit | 18fbe394d62371bedaa41ed32c89c659109ae8f5 (patch) | |
tree | abee5c0888e2e05b7ff80a7f92572e3d6df3ecbf /gcc/haifa-sched.c | |
parent | eacac712e337690ee21ce37fd06b2fe8b10a58f1 (diff) | |
download | gcc-18fbe394d62371bedaa41ed32c89c659109ae8f5.zip gcc-18fbe394d62371bedaa41ed32c89c659109ae8f5.tar.gz gcc-18fbe394d62371bedaa41ed32c89c659109ae8f5.tar.bz2 |
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.
From-SVN: r257481
Diffstat (limited to 'gcc/haifa-sched.c')
-rw-r--r-- | gcc/haifa-sched.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index ebdec46..4a899b5 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. |