Reset insn priority after inc/ref replacement

This patch recomputes the insn priority when a replacement for one of its
dependent insns is applied.

gcc/ChangeLog:

	* haifa-sched.c (priority): Add force_recompute parameter.
	(apply_replacement): Call priority () with force_recompute = true.
	(restore_pattern): Likewise.

From-SVN: r265304
This commit is contained in:
Robin Dapp 2018-10-19 06:25:30 +00:00 committed by Robin Dapp
parent e75883a503
commit 079c81d010
2 changed files with 24 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2018-10-19 Robin Dapp <rdapp@linux.ibm.com>
* haifa-sched.c (priority): Add force_recompute parameter.
(apply_replacement): Call priority () with force_recompute = true.
(restore_pattern): Likewise.
2018-10-18 H.J. Lu <hongjiu.lu@intel.com>
* simplify-rtx.c (simplify_subreg): Limit mask of vec_merge to

View File

@ -830,7 +830,7 @@ add_delay_dependencies (rtx_insn *insn)
/* Forward declarations. */
static int priority (rtx_insn *);
static int priority (rtx_insn *, bool force_recompute = false);
static int autopref_rank_for_schedule (const rtx_insn *, const rtx_insn *);
static int rank_for_schedule (const void *, const void *);
static void swap_sort (rtx_insn **, int);
@ -1590,7 +1590,7 @@ bool sched_fusion;
/* Compute the priority number for INSN. */
static int
priority (rtx_insn *insn)
priority (rtx_insn *insn, bool force_recompute)
{
if (! INSN_P (insn))
return 0;
@ -1598,7 +1598,7 @@ priority (rtx_insn *insn)
/* We should not be interested in priority of an already scheduled insn. */
gcc_assert (QUEUE_INDEX (insn) != QUEUE_SCHEDULED);
if (!INSN_PRIORITY_KNOWN (insn))
if (force_recompute || !INSN_PRIORITY_KNOWN (insn))
{
int this_priority = -1;
@ -4713,7 +4713,12 @@ apply_replacement (dep_t dep, bool immediately)
success = validate_change (desc->insn, desc->loc, desc->newval, 0);
gcc_assert (success);
rtx_insn *insn = DEP_PRO (dep);
/* Recompute priority since dependent priorities may have changed. */
priority (insn, true);
update_insn_after_change (desc->insn);
if ((TODO_SPEC (desc->insn) & (HARD_DEP | DEP_POSTPONED)) == 0)
fix_tick_ready (desc->insn);
@ -4767,7 +4772,17 @@ restore_pattern (dep_t dep, bool immediately)
success = validate_change (desc->insn, desc->loc, desc->orig, 0);
gcc_assert (success);
rtx_insn *insn = DEP_PRO (dep);
if (QUEUE_INDEX (insn) != QUEUE_SCHEDULED)
{
/* Recompute priority since dependent priorities may have changed. */
priority (insn, true);
}
update_insn_after_change (desc->insn);
if (backtrack_queue != NULL)
{
backtrack_queue->replacement_deps.safe_push (dep);