This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Reset insn priority after inc/ref replacement in haifa sched
- From: Robin Dapp <rdapp at linux dot ibm dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 10 Oct 2018 18:03:11 +0200
- Subject: [PATCH] Reset insn priority after inc/ref replacement in haifa sched
Hi,
as my last message
(https://gcc.gnu.org/ml/gcc-patches/2018-10/msg00280.html) did not
garner much attention, I'm posting it in proper patch form this time.
The problem I'm trying to solve is that an insn's priority seems
unchanged if the priority of insns that depend on it is changed (and the
first insn's priority was computed by on of these dependent insns'
priority). If I missed something or there is another way this should be
working, I'd like to learn about that.
A non-bootstrapped test suite run on s390 showed no regressions and an
x86 one is currently running (current HEAD didn't bootstrap for me on
x86). The actual code changes throughout SPEC2006 are minor and the
performance impact is negligible provided we do not hit a fixable bad
case as described in my last message.
Regards
Robin
--
gcc/ChangeLog:
2018-10-10 Robin Dapp <rdapp@linux.ibm.com>
* haifa-sched.c (apply_replacement):
Reset insn priority after inc/ref replacement.
commit 69ade62116eecf0a2bdf1cb099158e6d1dca1f3f
Author: Robin Dapp <rdapp@linux.ibm.com>
Date: Mon Oct 8 15:26:58 2018 +0200
recompute priority of insn whose dependencies have changed after applying an inc/ref replacement.
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 1fdc9df9fb2..1a7fe7b78e2 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -4713,7 +4713,21 @@ 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);
+
+ INSN_PRIORITY_STATUS (insn) = -1;
+
+ sd_iterator_def sd_it;
+ sd_it = sd_iterator_start (insn, SD_LIST_FORW);
+ while (sd_iterator_cond (&sd_it, &dep))
+ {
+ DEP_COST (dep) = UNKNOWN_DEP_COST;
+ sd_iterator_next (&sd_it);
+ }
+
+ priority (insn);
update_insn_after_change (desc->insn);
+
if ((TODO_SPEC (desc->insn) & (HARD_DEP | DEP_POSTPONED)) == 0)
fix_tick_ready (desc->insn);