diff options
author | vmakarov <vmakarov@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-08-02 20:57:04 +0000 |
---|---|---|
committer | vmakarov <vmakarov@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-08-02 20:57:04 +0000 |
commit | 9b72ac786c51faf5f7496c0c99bba05103d274af (patch) | |
tree | f040ca79165d580721f860540c3cca7ef82f89a2 | |
parent | 7a2ea99fb4ed728e7ee3176d94b1099ad2037742 (diff) | |
download | gcc-9b72ac786c51faf5f7496c0c99bba05103d274af.tar.gz |
2016-08-02 Vladimir Makarov <vmakarov@redhat.com>
PR middle-end/72778
* lra-spills.c (regno_in_use_p): New.
(lra_final_code_change): Use it.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239000 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/lra-spills.c | 22 |
2 files changed, 22 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a5fe1d5cf31..bec28247100 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2016-08-02 Vladimir Makarov <vmakarov@redhat.com> + PR middle-end/72778 + * lra-spills.c (regno_in_use_p): New. + (lra_final_code_change): Use it. + +2016-08-02 Vladimir Makarov <vmakarov@redhat.com> + PR rtl-optimization/69847 * lra-int.h (struct lra-reg): Use restore_rtx instead of restore_regno. diff --git a/gcc/lra-spills.c b/gcc/lra-spills.c index 1801b7bb391..a5073b69f46 100644 --- a/gcc/lra-spills.c +++ b/gcc/lra-spills.c @@ -686,6 +686,20 @@ return_regno_p (unsigned int regno) return false; } +/* Return true if REGNO is one of subsequent USE after INSN. */ +static bool +regno_in_use_p (rtx_insn *insn, unsigned int regno) +{ + while ((insn = next_nondebug_insn (insn)) != NULL_RTX + && INSN_P (insn) && GET_CODE (PATTERN (insn)) == USE) + { + if (REG_P (XEXP (PATTERN (insn), 0)) + && regno == REGNO (XEXP (PATTERN (insn), 0))) + return TRUE; + } + return false; +} + /* Final change of pseudos got hard registers into the corresponding hard registers and removing temporary clobbers. */ void @@ -693,7 +707,7 @@ lra_final_code_change (void) { int i, hard_regno; basic_block bb; - rtx_insn *insn, *curr, *next_insn; + rtx_insn *insn, *curr; int max_regno = max_reg_num (); for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++) @@ -728,11 +742,7 @@ lra_final_code_change (void) && REG_P (SET_SRC (pat)) && REG_P (SET_DEST (pat)) && REGNO (SET_SRC (pat)) == REGNO (SET_DEST (pat)) && (! return_regno_p (REGNO (SET_SRC (pat))) - || (next_insn = next_nondebug_insn (insn)) == NULL_RTX - || ! INSN_P (next_insn) - || GET_CODE (PATTERN (next_insn)) != USE - || ! REG_P (XEXP (PATTERN (next_insn), 0)) - || REGNO (SET_SRC (pat)) != REGNO (XEXP (PATTERN (next_insn), 0)))) + || ! regno_in_use_p (insn, REGNO (SET_SRC (pat))))) { lra_invalidate_insn_data (insn); delete_insn (insn); |