From 59df2b2b6ffe4a193824b8282eeba345495b7117 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Mon, 23 Sep 1996 16:07:01 -0400 Subject: [PATCH] (jump_optimize): In no-nop move deletion, don't test PRESERVE_DEATH_INFO_REGNO_P... (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 | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/gcc/jump.c b/gcc/jump.c index 3ce95201c02..6e0e30b14ff 100644 --- a/gcc/jump.c +++ b/gcc/jump.c @@ -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); } } -- 2.30.2