Patchwork [committed] Fix rtx-sharing problem in split_insns

login
register
mail settings
Submitter Richard Sandiford
Date Aug. 2, 2012, 8:44 p.m.
Message ID <87sjc5m3av.fsf@talisman.home>
Download mbox | patch
Permalink /patch/174811/
State New
Headers show

Comments

Richard Sandiford - Aug. 2, 2012, 8:44 p.m.
I hit a case where we were splitting a set of (const (unspec [...]))
into something that still referred to the original expression.
We reused that same expression as a REG_EQUAL note, leading to
an rtx-sharing violation.

Tested on mips64-linux-gnu and applied.

Richard


gcc/
	* recog.c (split_insn): Copy the original SET_SRC before using
	it as a note.

Patch

Index: gcc/recog.c
===================================================================
--- gcc/recog.c	2012-08-02 21:19:07.321527035 +0100
+++ gcc/recog.c	2012-08-02 21:22:58.721526468 +0100
@@ -2831,7 +2831,8 @@  split_insn (rtx insn)
 	  if (note && CONSTANT_P (XEXP (note, 0)))
 	    set_unique_reg_note (last, REG_EQUAL, XEXP (note, 0));
 	  else if (CONSTANT_P (SET_SRC (insn_set)))
-	    set_unique_reg_note (last, REG_EQUAL, SET_SRC (insn_set));
+	    set_unique_reg_note (last, REG_EQUAL,
+				 copy_rtx (SET_SRC (insn_set)));
 	}
     }