From: Uros Bizjak Date: Wed, 21 Nov 2018 21:52:06 +0000 (+0100) Subject: Revert the revert: X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=13986a58e723e4608ce0172d6713a7a9b06a4c30;p=gcc.git Revert the revert: 2013-10-26 Vladimir Makarov Revert: 2013-10-25 Vladimir Makarov * lra-spills.c (lra_final_code_change): Remove useless move insns. From-SVN: r266358 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5e09cd6d04f..ee5f1835b95 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2018-11-21 Uros Bizjak + + Revert the revert: + 2013-10-26 Vladimir Makarov + + Revert: + 2013-10-25 Vladimir Makarov + + * lra-spills.c (lra_final_code_change): Remove useless move insns. + 2018-11-21 Uros Bizjak PR middle-end/88129 diff --git a/gcc/lra-spills.c b/gcc/lra-spills.c index 33caf9f4564..008d7399687 100644 --- a/gcc/lra-spills.c +++ b/gcc/lra-spills.c @@ -740,6 +740,7 @@ lra_final_code_change (void) int i, hard_regno; basic_block bb; rtx_insn *insn, *curr; + rtx set; int max_regno = max_reg_num (); for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++) @@ -818,5 +819,19 @@ lra_final_code_change (void) } if (insn_change_p) lra_update_operator_dups (id); + + if ((set = single_set (insn)) != NULL + && REG_P (SET_SRC (set)) && REG_P (SET_DEST (set)) + && REGNO (SET_SRC (set)) == REGNO (SET_DEST (set))) + { + /* Remove an useless move insn. IRA can generate move + insns involving pseudos. It is better remove them + earlier to speed up compiler a bit. It is also + better to do it here as they might not pass final RTL + check in LRA, (e.g. insn moving a control register + into itself). */ + lra_invalidate_insn_data (insn); + delete_insn (insn); + } } }