https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94541
--- Comment #9 from H.J. Lu <hjl.tools at gmail dot com> --- I am testing this: diff --git a/gcc/lra-spills.c b/gcc/lra-spills.c index 0caa4acd3b5..bd4ee80245d 100644 --- a/gcc/lra-spills.c +++ b/gcc/lra-spills.c @@ -844,9 +844,14 @@ lra_final_code_change (void) struct lra_static_insn_data *static_id = id->insn_static_data; bool insn_change_p = false; + set = single_set (insn); + /* NB: Never change SUBREG in the source operand of a SET + insn to REG. */ for (i = id->insn_static_data->n_operands - 1; i >= 0; i--) if ((DEBUG_INSN_P (insn) || ! static_id->operand[i].is_operator) + && (set == NULL + || !rtx_equal_p (SET_SRC (set), *id->operand_loc[i])) && alter_subregs (id->operand_loc[i], ! DEBUG_INSN_P (insn))) { lra_update_dup (id, i); @@ -855,7 +860,7 @@ lra_final_code_change (void) if (insn_change_p) lra_update_operator_dups (id); - if ((set = single_set (insn)) != NULL + if (set != NULL && REG_P (SET_SRC (set)) && REG_P (SET_DEST (set)) && REGNO (SET_SRC (set)) == REGNO (SET_DEST (set))) {