Commit 18fbe394 by Wilco Dijkstra Committed by Wilco Dijkstra

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
parent eacac712
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> 2018-02-08 Aldy Hernandez <aldyh@redhat.com>
PR tree-optimization/84224 PR tree-optimization/84224
......
...@@ -2783,11 +2783,10 @@ rank_for_schedule (const void *x, const void *y) ...@@ -2783,11 +2783,10 @@ rank_for_schedule (const void *x, const void *y)
} }
/* Prefer instructions that occur earlier in the model schedule. */ /* Prefer instructions that occur earlier in the model schedule. */
if (sched_pressure == SCHED_PRESSURE_MODEL if (sched_pressure == SCHED_PRESSURE_MODEL)
&& INSN_BB (tmp) == target_bb && INSN_BB (tmp2) == target_bb)
{ {
diff = model_index (tmp) - model_index (tmp2); diff = model_index (tmp) - model_index (tmp2);
gcc_assert (diff != 0); if (diff != 0)
return rfs_result (RFS_PRESSURE_INDEX, diff, tmp, tmp2); return rfs_result (RFS_PRESSURE_INDEX, diff, tmp, tmp2);
} }
......
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> 2018-02-08 Richard Biener <rguenther@suse.de>
* g++.dg/vect/slp-pr56812.cc: Allow either basic-block or * g++.dg/vect/slp-pr56812.cc: Allow either basic-block or
......
/* { 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment