public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* RFT: Fix PR middle/end-40154
@ 2011-11-08  0:32 joern.rennecke
  2011-11-08 12:38 ` Kaz Kojima
  2011-11-08 12:47 ` Eric Botcazou
  0 siblings, 2 replies; 11+ messages in thread
From: joern.rennecke @ 2011-11-08  0:32 UTC (permalink / raw)
  To: gcc-patches


[-- Attachment #1.1: Type: text/plain, Size: 208 bytes --]

This fixes the problem on the Epiphany, but I haven't tested if it also fixes it on
the SH - AAUI you'd have to back out a workaround first to properly test it.

Bootstrapped powerpc64-unknown-linux-gnu.

[-- Attachment #2: pr40154-fix --]
[-- Type: application/octet-stream, Size: 1292 bytes --]

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

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

Index: emit-rtl.c
===================================================================
--- emit-rtl.c	(revision 181122)
+++ emit-rtl.c	(working copy)
@@ -4951,8 +4951,27 @@
 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);
+  gcc_assert (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;
+    }
+  note = find_reg_note (insn, kind, NULL_RTX);
+
   switch (kind)
     {
     case REG_EQUAL:

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-11-10 15:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-08  0:32 RFT: Fix PR middle/end-40154 joern.rennecke
2011-11-08 12:38 ` Kaz Kojima
2011-11-08 13:30   ` Joern Rennecke
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

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).