(eliminate_regs, case SUBREG): Add USE of pseudo so we don't
authorRichard Kenner <kenner@gcc.gnu.org>
Sun, 7 Aug 1994 12:53:44 +0000 (08:53 -0400)
committerRichard Kenner <kenner@gcc.gnu.org>
Sun, 7 Aug 1994 12:53:44 +0000 (08:53 -0400)
improperly delete an output reload.

From-SVN: r7869

gcc/reload1.c

index 6e3c7e57b7a1661ed3ca5c9717cb5e87b8301ee9..9223c217553819b2f91e81b796474f802ae7c3f1 100644 (file)
@@ -2886,11 +2886,20 @@ eliminate_regs (x, mem_mode, insn)
 
          /* If we didn't change anything, we must retain the pseudo.  */
          if (new == reg_equiv_memory_loc[REGNO (SUBREG_REG (x))])
-           new = XEXP (x, 0);
+           new = SUBREG_REG (x);
          else
-           /* Otherwise, ensure NEW isn't shared in case we have to reload
-              it.  */
-           new = copy_rtx (new);
+           {
+             /* Otherwise, ensure NEW isn't shared in case we have to reload
+                it.  */
+             new = copy_rtx (new);
+
+             /* In this case, we must show that the pseudo is used in this
+                insn so that delete_output_reload will do the right thing.  */
+             if (insn != 0 && GET_CODE (insn) != EXPR_LIST
+                 && GET_CODE (insn) != INSN_LIST)
+               emit_insn_before (gen_rtx (USE, VOIDmode, SUBREG_REG (x)),
+                                 insn);
+           }
        }
       else
        new = eliminate_regs (SUBREG_REG (x), mem_mode, insn);