diff options
Diffstat (limited to 'gcc/lra-constraints.c')
-rw-r--r-- | gcc/lra-constraints.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index ef18100125d..b070218145a 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -5850,6 +5850,24 @@ get_regno (rtx reg) return -1; } +/* Delete a move INSN with destination reg DREGNO and a previous + clobber insn with the same regno. The inheritance/split code can + generate moves with preceding clobber and when we delete such moves + we should delete the clobber insn too to keep the correct life + info. */ +static void +delete_move_and_clobber (rtx_insn *insn, int dregno) +{ + rtx_insn *prev_insn = PREV_INSN (insn); + + lra_set_insn_deleted (insn); + lra_assert (dregno > 0); + if (prev_insn != NULL && NONDEBUG_INSN_P (prev_insn) + && GET_CODE (PATTERN (prev_insn)) == CLOBBER + && dregno == get_regno (XEXP (PATTERN (prev_insn), 0))) + lra_set_insn_deleted (prev_insn); +} + /* Remove inheritance/split pseudos which are in REMOVE_PSEUDOS and return true if we did any change. The undo transformations for inheritance looks like @@ -5922,7 +5940,7 @@ remove_inheritance_pseudos (bitmap remove_pseudos) ? "split" : "inheritance"); dump_insn_slim (lra_dump_file, curr_insn); } - lra_set_insn_deleted (curr_insn); + delete_move_and_clobber (curr_insn, dregno); done_p = true; } else if (bitmap_bit_p (remove_pseudos, sregno) @@ -6122,7 +6140,7 @@ undo_optional_reloads (void) INSN_UID (insn)); dump_insn_slim (lra_dump_file, insn); } - lra_set_insn_deleted (insn); + delete_move_and_clobber (insn, REGNO (dest)); continue; } /* We should not worry about generation memory-memory |