public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/53942] [4.6/4.7/4.8 Regression] unable to find a register to spill in class 'CREG'
Date: Mon, 16 Jul 2012 11:54:00 -0000	[thread overview]
Message-ID: <bug-53942-4-lSMAr3s5JZ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-53942-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53942

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-07-16 11:54:23 UTC ---
The following patch fixes this issue during expansion, don't have time right
now to test what effects it might have on generated code though:
--- gcc/function.c.jj    2012-06-25 08:38:26.000000000 +0200
+++ gcc/function.c    2012-07-16 13:41:52.847928315 +0200
@@ -2988,11 +2988,26 @@ assign_parm_setup_reg (struct assign_par
       && insn_operand_matches (icode, 1, op1))
     {
       enum rtx_code code = unsignedp ? ZERO_EXTEND : SIGN_EXTEND;
-      rtx insn, insns;
+      rtx insn, insns, t = op1;
       HARD_REG_SET hardregs;

       start_sequence ();
-      insn = gen_extend_insn (op0, op1, promoted_nominal_mode,
+      /* If op1 is a hard register that is likely spilled, first
+         force it into a pseudo, otherwise combiner might extend
+         its lifetime too much.  */
+      if (GET_CODE (t) == SUBREG)
+        t = SUBREG_REG (t);
+      if (REG_P (t)
+          && HARD_REGISTER_P (t)
+          && ! TEST_HARD_REG_BIT (fixed_reg_set, REGNO (t))
+          && targetm.class_likely_spilled_p (REGNO_REG_CLASS (REGNO (t))))
+        {
+          t = gen_reg_rtx (GET_MODE (op1));
+          emit_move_insn (t, op1);
+        }
+      else
+        t = op1;
+      insn = gen_extend_insn (op0, t, promoted_nominal_mode,
                   data->passed_mode, unsignedp);
       emit_insn (insn);
       insns = get_insns ();


  parent reply	other threads:[~2012-07-16 11:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-12 16:24 [Bug rtl-optimization/53942] New: " ncahill_alt at yahoo dot com
2012-07-13 14:21 ` [Bug target/53942] [4.6/4.7/4.8 Regression] " ubizjak at gmail dot com
2012-07-13 14:37 ` [Bug rtl-optimization/53942] " ubizjak at gmail dot com
2012-07-16 11:32 ` jakub at gcc dot gnu.org
2012-07-16 11:54 ` jakub at gcc dot gnu.org [this message]
2012-07-19 20:49 ` jakub at gcc dot gnu.org
2012-08-10 14:41 ` izamyatin at gmail dot com
2012-08-13  7:35 ` jakub at gcc dot gnu.org
2012-09-02 13:57 ` [Bug rtl-optimization/53942] [4.6 " ubizjak at gmail dot com
2013-04-12 16:27 ` 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-53942-4-lSMAr3s5JZ@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).