public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vmakarov at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/110034] The first popped allcono doesn't take precedence over later popped in ira coloring
Date: Thu, 24 Aug 2023 13:35:31 +0000	[thread overview]
Message-ID: <bug-110034-4-kZdoteZzJf@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110034-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110034

--- Comment #4 from Vladimir Makarov <vmakarov at gcc dot gnu.org> ---
Thank you for providing the test case.

To be honest I don't see why assigning to hr3 to r134 is better.
Currently we have the following assignments:

hr9->r134; hr3->r173; hr3->r124

and the related preferences:

  cp11:a18(r134)<->a29(r173)@125:shuffle
  pref3:a29(r173)<-hr3@2000
  pref4:a0(r124)<-hr3@125

This removes cost 2000 (pref3) and cost 125 (pref4) and adds cost 125
(cp11).  The profit is 2000

If we started with r173, we would have the following assignments:

hr3->r173; hr3->r134; <some hard reg but hr3>->r124

This would remove cost 2000 (pref3) and cost 125 (cp11) and add cost
125 (pref).  The profit would be the same 2000.

Choice of heuristics is very time consuming.  I spent a lot of time to
try and benchmark numerous ones.  I clearly remember that introduction
of pseudo threads for colorable busket gave visible performance
improvement.  Currently we assign pseudos from a thread with the
biggest frequency first (r173 and r134) and a pseudo (r134) with the
biggest frequency first from the same thread.  I think it is logical.

Also it is always possible to find a test (not this case) where
heuristics give some undesirable results.  RA is NP-complete task even
in the simplest formulation. We can not get the optimal solution for
reasonable time.

Still I am open to change any heuristic if somebody can show that it
improves performance for some credible benchmark (I prefer SPEC2007)
on major GCC targets.

  parent reply	other threads:[~2023-08-24 13:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-30  8:02 [Bug rtl-optimization/110034] New: " guihaoc at gcc dot gnu.org
2023-05-30  8:09 ` [Bug rtl-optimization/110034] " rguenth at gcc dot gnu.org
2023-05-30  9:32 ` guihaoc at gcc dot gnu.org
2023-05-30  9:32 ` guihaoc at gcc dot gnu.org
2023-08-24 13:35 ` vmakarov at gcc dot gnu.org [this message]
2023-08-29  9:01 ` guihaoc at gcc dot gnu.org
2023-08-31  5:02 ` guihaoc at gcc dot gnu.org

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=bug-110034-4-kZdoteZzJf@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).