public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Maxim Kuvyrkov <mkuvyrkov@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-2946] Improve autoprefetcher heuristic (partly fix regression in PR91598)
Date: Tue, 17 Aug 2021 10:12:03 +0000 (GMT)	[thread overview]
Message-ID: <20210817101203.A996C384801E@sourceware.org> (raw)

https://gcc.gnu.org/g:6d527883072ce96a33169036fca7740172223b52

commit r12-2946-g6d527883072ce96a33169036fca7740172223b52
Author: Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>
Date:   Thu Aug 29 15:21:36 2019 +0000

    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.

Diff:
---
 gcc/haifa-sched.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 26d11279551..5048dd4a5a3 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;


                 reply	other threads:[~2021-08-17 10:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210817101203.A996C384801E@sourceware.org \
    --to=mkuvyrkov@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).