public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joern Rennecke <joern.rennecke@embecosm.com>
To: Kaz Kojima <kkojima@rr.iij4u.or.jp>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: RFT: Fix PR middle/end-40154
Date: Tue, 08 Nov 2011 13:30:00 -0000	[thread overview]
Message-ID: <20111108081145.k697g6oymos8c4so-nzlynne@webmail.spamcop.net> (raw)
In-Reply-To: <20111108.211651.151281633.kkojima@rr.iij4u.or.jp>

[-- Attachment #1: Type: text/plain, Size: 373 bytes --]

Quoting Kaz Kojima <kkojima@rr.iij4u.or.jp>:

> It seems that find_reloads calls set_unique_reg_note for
> a USE insn.

That's true, and it is by design.
This use of set_unique_reg_note is a bit debatable - add_reg_note
should do just fine there.

OTOH keeping this as it is, and keeping set_unique_reg_note accepting USE
in this case, seems more conservative for stage3.


[-- Attachment #2: pr40154-fix-2 --]
[-- Type: text/plain, Size: 1528 bytes --]

2011-11-07  Joern Rennecke  <joern.rennecke@embecosm.com>

	* emit-rtl.c (set_unique_reg_note): Don't add notes that disagree
	with the SET_DEST of INSN.

Index: trunk/gcc/emit-rtl.c
===================================================================
--- trunk/gcc/emit-rtl.c	(revision 181122)
+++ trunk/gcc/emit-rtl.c	(working copy)
@@ -4951,8 +4951,32 @@
 rtx
 set_unique_reg_note (rtx insn, enum reg_note kind, rtx datum)
 {
-  rtx note = find_reg_note (insn, kind, NULL_RTX);
+  rtx set, note;
+  enum machine_mode mode;
 
+  /* Sometimes the value is calculated with some SUBREG tricks, so the
+     SET_DEST of INSN ends up with a different mode then DATUM.  */
+  set = single_set (insn);
+  if (set)
+    {
+      mode = GET_MODE (SET_DEST (set));
+      /* If DATUM is too narrow, we can't make it fit.  */
+      if ((GET_MODE (datum) != VOIDmode || GET_MODE_CLASS (mode) != MODE_INT)
+	  && GET_MODE_SIZE (mode) > GET_MODE_SIZE (GET_MODE (datum)))
+	return NULL_RTX;
+      if (GET_MODE (datum) != VOIDmode && GET_MODE (datum) != mode)
+	{
+	  /* Adjust DATUM to the SET_DEST.  */
+	  datum = simplify_gen_subreg (mode, datum, GET_MODE (datum), 0);
+	  if (!datum)
+	    return NULL_RTX;
+	}
+    }
+  else /* Reload uses USEs with REG_EQUAL notes attached to keep track of
+	  reload inhertiance opportunities.  */
+    gcc_assert (PATTERN (insn) == USE && reload_in_progress);
+  note = find_reg_note (insn, kind, NULL_RTX);
+
   switch (kind)
     {
     case REG_EQUAL:

  reply	other threads:[~2011-11-08 13:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-08  0:32 joern.rennecke
2011-11-08 12:38 ` Kaz Kojima
2011-11-08 13:30   ` Joern Rennecke [this message]
2011-11-08 14:57     ` Kaz Kojima
2011-11-09 15:04       ` Kaz Kojima
2011-11-08 12:47 ` Eric Botcazou
2011-11-08 13:12   ` Joern Rennecke
2011-11-08 13:37     ` Eric Botcazou
2011-11-08 13:40       ` Joern Rennecke
2011-11-10 16:23         ` Eric Botcazou
2011-11-08 14:03       ` Joern Rennecke

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=20111108081145.k697g6oymos8c4so-nzlynne@webmail.spamcop.net \
    --to=joern.rennecke@embecosm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kkojima@rr.iij4u.or.jp \
    /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).