From: Richard Kenner Date: Wed, 4 May 1994 20:41:15 +0000 (-0400) Subject: (emit_reload_insns): Add another way to delete an output reload. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=761827969bfb2200a63850c4e97042389d0e503a;p=gcc.git (emit_reload_insns): Add another way to delete an output reload. From-SVN: r7209 --- diff --git a/gcc/reload1.c b/gcc/reload1.c index 7a44245468c..c5877e3174a 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -5614,6 +5614,21 @@ emit_reload_insns (insn) else if (GET_CODE (oldequiv) == SUBREG) oldequiv_reg = SUBREG_REG (oldequiv); + /* If we are reloading from a register that was recently stored in + with an output-reload, see if we can prove there was + actually no need to store the old value in it. */ + + if (optimize && GET_CODE (oldequiv) == REG + && REGNO (oldequiv) < FIRST_PSEUDO_REGISTER + && spill_reg_order[REGNO (oldequiv)] >= 0 + && spill_reg_store[reload_spill_index[REGNO (oldequiv)]] != 0 + && dead_or_set_p (insn, reload_in[j]) + /* This is unsafe if operand occurs more than once in current + insn. Perhaps some occurrences weren't reloaded. */ + && count_occurrences (PATTERN (insn), reload_in[j]) == 1) + delete_output_reload + (insn, j, spill_reg_store[spill_reg_order[REGNO (oldequiv)]]); + /* Encapsulate both RELOADREG and OLDEQUIV into that mode, then load RELOADREG from OLDEQUIV. Note that we cannot use gen_lowpart_common since it can do the wrong thing when