(force_reg): Don't make a REG_EQUAL note for an insn that doesn't set
authorRichard Kenner <kenner@gcc.gnu.org>
Thu, 14 Jul 1994 13:42:18 +0000 (09:42 -0400)
committerRichard Kenner <kenner@gcc.gnu.org>
Thu, 14 Jul 1994 13:42:18 +0000 (09:42 -0400)
TEMP.

From-SVN: r7771

gcc/explow.c

index 1c94b816c19636691ebb6b695691d1a2fd11ce1d..b72e468e050aaedc2460fdbe6f2e784ba9d7736f 100644 (file)
@@ -578,15 +578,19 @@ force_reg (mode, x)
      enum machine_mode mode;
      rtx x;
 {
-  register rtx temp, insn;
+  register rtx temp, insn, set;
 
   if (GET_CODE (x) == REG)
     return x;
   temp = gen_reg_rtx (mode);
   insn = emit_move_insn (temp, x);
+
   /* Let optimizers know that TEMP's value never changes
-     and that X can be substituted for it.  */
-  if (CONSTANT_P (x))
+     and that X can be substituted for it.  Don't get confused
+     if INSN set something else (such as a SUBREG of TEMP).  */
+  if (CONSTANT_P (x)
+      && (set = single_set (insn)) != 0
+      && SET_DEST (set) == temp)
     {
       rtx note = find_reg_note (insn, REG_EQUAL, NULL_RTX);