public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/64895] RA picks the wrong register for -fipa-ra
Date: Tue, 10 Mar 2015 10:24:00 -0000	[thread overview]
Message-ID: <bug-64895-4-oW0nzLSLJl@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64895-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from vries at gcc dot gnu.org ---
>From PR64342 comment 7:

Register allocation seems to progress similarly, up until this message in
reload, which seems to be directly related to the r216154 patch:
...
    Spill r86 after risky transformations
  Reassigning non-reload pseudos
           Assign 3 to r86 (freq=3000)
...

I've looked a bit in more detail at this message.

fipa-ra manages to allocate hardreg 1 (dx) to the call-crossing liverange as
before. But setup_live_pseudos_and_spill_after_risky_transforms looks at the
conflict regs, and finds that lra_reg_info[regno].conflict_hard_regs contains
dx. Hence, it spills the liverange into an available reg, which happens to be
hardreg 3 (bx).

So, the risky transformations and fipa-ra have in common that they allocate
registers from the conflict_hard_regs set. In the case of -fipa-ra, we don't
want setup_live_pseudos_and_spill_after_risky_transforms to undo the -fipa-ra
allocation, but currently there's no way to distinguish between the two.

Using this patch, we make sure the conflict registers don't include dx for this
testcase, and the test-cases passes again:
...
diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c
index 9dfffb6..0231057 100644
--- a/gcc/lra-lives.c
+++ b/gcc/lra-lives.c
@@ -636,8 +636,11 @@ check_pseudos_live_through_calls (int regno)
   if (! sparseset_bit_p (pseudos_live_through_calls, regno))
     return;
   sparseset_clear_bit (pseudos_live_through_calls, regno);
+
   IOR_HARD_REG_SET (lra_reg_info[regno].conflict_hard_regs,
-                   call_used_reg_set);
+                   !hard_reg_set_empty_p
(lra_reg_info[regno].actual_call_used_reg_set)
+                   ? lra_reg_info[regno].actual_call_used_reg_set
+                   : call_used_reg_set);

   for (hr = 0; hr < FIRST_PSEUDO_REGISTER; hr++)
     if (HARD_REGNO_CALL_PART_CLOBBERED (hr, PSEUDO_REGNO_MODE (regno)))
...


  parent reply	other threads:[~2015-03-10 10:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-01 13:47 [Bug rtl-optimization/64895] New: [5 Regression] " hjl.tools at gmail dot com
2015-02-01 19:09 ` [Bug rtl-optimization/64895] " jakub at gcc dot gnu.org
2015-02-01 19:22 ` hjl.tools at gmail dot com
2015-02-01 19:24 ` jakub at gcc dot gnu.org
2015-02-01 19:25 ` hjl.tools at gmail dot com
2015-03-06  8:04 ` [Bug rtl-optimization/64895] " ubizjak at gmail dot com
2015-03-10 10:24 ` vries at gcc dot gnu.org [this message]
2015-03-10 19:21 ` vmakarov at gcc dot gnu.org
2015-03-12 11:11 ` vries at gcc dot gnu.org
2015-03-12 11:27 ` vries at gcc dot gnu.org
2015-03-16  9:42 ` vries at gcc dot gnu.org
2015-03-16  9:44 ` jakub 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-64895-4-oW0nzLSLJl@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).