aboutsummaryrefslogtreecommitdiff
path: root/gcc/haifa-sched.c
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2019-08-29 15:21:36 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2021-08-17 09:51:52 +0000
commit6d527883072ce96a33169036fca7740172223b52 (patch)
treeaf3d90d2b53a7bfde5817c2bbc0ca118216b58cd /gcc/haifa-sched.c
parent568b9c0e8ee482228f6c565730447de5b18e7cb3 (diff)
downloadgcc-6d527883072ce96a33169036fca7740172223b52.zip
gcc-6d527883072ce96a33169036fca7740172223b52.tar.gz
gcc-6d527883072ce96a33169036fca7740172223b52.tar.bz2
Improve autoprefetcher heuristic (partly fix regression in PR91598)
PR rtl-optimization/91598 * haifa-sched.c (autopref_rank_for_schedule): Prioritize "irrelevant" insns after memory reads and before memory writes.
Diffstat (limited to 'gcc/haifa-sched.c')
-rw-r--r--gcc/haifa-sched.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 26d1127..5048dd4 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -5683,9 +5683,16 @@ autopref_rank_for_schedule (const rtx_insn *insn1, const rtx_insn *insn2)
int irrel2 = data2->status == AUTOPREF_MULTIPASS_DATA_IRRELEVANT;
if (!irrel1 && !irrel2)
+ /* Sort memory references from lowest offset to the largest. */
r = data1->offset - data2->offset;
- else
+ else if (write)
+ /* Schedule "irrelevant" insns before memory stores to resolve
+ as many producer dependencies of stores as possible. */
r = irrel2 - irrel1;
+ else
+ /* Schedule "irrelevant" insns after memory reads to avoid breaking
+ memory read sequences. */
+ r = irrel1 - irrel2;
}
return r;