public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: gcc-patches@gcc.gnu.org
Cc: Vladimir Makarov <vmakarov@redhat.com>
Subject: [PATCH] PR79584, lra ICE in base_to_reg
Date: Wed, 22 Feb 2017 21:22:00 -0000	[thread overview]
Message-ID: <20170222202522.GK14945@bubble.grove.modra.org> (raw)

This patch allows lra to reload a lo_sum address.  Given a mem with a
lo_sum address as used by ppc32, decompose_mem_address returns an
address_info with *base the lo_sum and *base_term the reg within the
lo_sum.  When a lo_sum address isn't valid, we want to first try
reloading the entire lo_sum to a new reg.  I first fixed that, then
hit another ICE, this time in gen_int_mode.  gen_int_mode was being
called with the mode of the memory access, not the mode of the
address.

Bootstrapped and regression tested powerpc64le-linux and
powerpc64-linux bi-arch.  OK to apply?

	PR rtl-optimization/79584
	* lra-constraints.c (base_to_reg): Reload ad->base, the entire
	base, not ad->base_term, the reg within base.  Remove assertion
	that ad->base == ad->base_term.  Replace gen_int_mode using
	bogus mode with const0_rtx.

diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index bd5fbcd..0e98f22 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -2916,18 +2916,18 @@ base_to_reg (struct address_info *ad)
   rtx_insn *insn;
   rtx_insn *last_insn = get_last_insn();
 
-  lra_assert (ad->base == ad->base_term && ad->disp == ad->disp_term);
+  lra_assert (ad->disp == ad->disp_term);
   cl = base_reg_class (ad->mode, ad->as, ad->base_outer_code,
                        get_index_code (ad));
-  new_reg = lra_create_new_reg (GET_MODE (*ad->base_term), NULL_RTX,
+  new_reg = lra_create_new_reg (GET_MODE (*ad->base), NULL_RTX,
                                 cl, "base");
   new_inner = simplify_gen_binary (PLUS, GET_MODE (new_reg), new_reg,
                                    ad->disp_term == NULL
-                                   ? gen_int_mode (0, ad->mode)
+                                   ? const0_rtx
                                    : *ad->disp_term);
   if (!valid_address_p (ad->mode, new_inner, ad->as))
     return NULL_RTX;
-  insn = emit_insn (gen_rtx_SET (new_reg, *ad->base_term));
+  insn = emit_insn (gen_rtx_SET (new_reg, *ad->base));
   code = recog_memoized (insn);
   if (code < 0)
     {

-- 
Alan Modra
Australia Development Lab, IBM

             reply	other threads:[~2017-02-22 20:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-22 21:22 Alan Modra [this message]
2017-02-22 23:14 ` Richard Sandiford
2017-02-23  1:21   ` Alan Modra
2017-02-23  1:49     ` Alan Modra
2017-02-24  0:35       ` Richard Sandiford
2017-02-24  5:20         ` Alan Modra
2017-02-25  7:42           ` Vladimir Makarov

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=20170222202522.GK14945@bubble.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=vmakarov@redhat.com \
    /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).