From: Robin Dapp Date: Fri, 19 Oct 2018 06:25:30 +0000 (+0000) Subject: Reset insn priority after inc/ref replacement X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=079c81d010e3303c8fdbc4669bf3907fe7a37052;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7c5f9dd4814..82cc005283f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-10-19 Robin Dapp + + * 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 * simplify-rtx.c (simplify_subreg): Limit mask of vec_merge to diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index 1fdc9df9fb2..2c84ce38143 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -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);