[committed] Fix rtx-sharing problem in split_insns

Richard Sandiford rdsandiford@googlemail.com
Thu Aug 2 20:44:00 GMT 2012


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.

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)));
 	}
     }
 



More information about the Gcc-patches mailing list