(jump_optimize): In no-nop move deletion, don't test PRESERVE_DEATH_INFO_REGNO_P...
authorRichard Kenner <kenner@gcc.gnu.org>
Mon, 23 Sep 1996 20:07:01 +0000 (16:07 -0400)
committerRichard Kenner <kenner@gcc.gnu.org>
Mon, 23 Sep 1996 20:07:01 +0000 (16:07 -0400)
(jump_optimize): In no-nop move deletion, don't test
PRESERVE_DEATH_INFO_REGNO_P; instead test if optimization is performed.
Check for REG_UNUSED note on to-be deleted insn before searching for preceding
instruction to delete note from.
If PRESERVE_DEATH_INFO_REGNO_P is true for SREG, replace INSN with USE.

From-SVN: r12783

gcc/jump.c

index 3ce95201c024e3344e2f0fc8b508e15d71d9403a..6e0e30b14ffa85b4dce45df8fc6382c51e837622 100644 (file)
@@ -449,28 +449,39 @@ jump_optimize (f, cross_jump, noop_moves, after_regscan)
                                              sreg, NULL_PTR, dreg,
                                              GET_MODE (SET_SRC (body)));
 
-#ifdef PRESERVE_DEATH_INFO_REGNO_P
-                   /* Deleting insn could lose a death-note for SREG or DREG
-                      so don't do it if final needs accurate death-notes.  */
-                   if (! PRESERVE_DEATH_INFO_REGNO_P (sreg)
-                       && ! PRESERVE_DEATH_INFO_REGNO_P (dreg))
-#endif
+                   if (tem != 0 &&
+                       GET_MODE (tem) == GET_MODE (SET_DEST (body)))
                      {
                        /* DREG may have been the target of a REG_DEAD note in
                           the insn which makes INSN redundant.  If so, reorg
                           would still think it is dead.  So search for such a
                           note and delete it if we find it.  */
-                       for (trial = prev_nonnote_insn (insn);
-                            trial && GET_CODE (trial) != CODE_LABEL;
-                            trial = prev_nonnote_insn (trial))
-                         if (find_regno_note (trial, REG_DEAD, dreg))
-                           {
-                             remove_death (dreg, trial);
-                             break;
-                           }
-
-                       if (tem != 0
-                           && GET_MODE (tem) == GET_MODE (SET_DEST (body)))
+                       if (! find_regno_note (insn, REG_UNUSED, dreg))
+                         for (trial = prev_nonnote_insn (insn);
+                              trial && GET_CODE (trial) != CODE_LABEL;
+                              trial = prev_nonnote_insn (trial))
+                           if (find_regno_note (trial, REG_DEAD, dreg))
+                             {
+                               remove_death (dreg, trial);
+                               break;
+                             }
+#ifdef PRESERVE_DEATH_INFO_REGNO_P
+                       /* Deleting insn could lose a death-note for SREG
+                          so don't do it if final needs accurate
+                          death-notes.  */
+                       if (PRESERVE_DEATH_INFO_REGNO_P (sreg)
+                           && (trial = find_regno_note (insn, REG_DEAD, sreg)))
+                         {
+                           /* Change this into a USE so that we won't emit
+                              code for it, but still can keep the note.  */
+                           PATTERN (insn)
+                             = gen_rtx (USE, VOIDmode, XEXP (trial, 0));
+                           /* Remove all reg notes but the REG_DEAD one.  */
+                           REG_NOTES (insn) = trial;
+                           XEXP (trial, 1) = NULL_RTX;
+                         }
+                       else
+#endif
                          delete_insn (insn);
                      }
                  }