https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117191
--- Comment #8 from denisc at gcc dot gnu.org --- I forgot to add condition for "except those that refer to the return value" The patch: diff --git a/gcc/lra-spills.cc b/gcc/lra-spills.cc index c149c3388cd..2f86ec0026c 100644 --- a/gcc/lra-spills.cc +++ b/gcc/lra-spills.cc @@ -741,10 +741,20 @@ lra_final_code_change (void) delete_insn (insn); continue; } - if (GET_CODE (pat) == CLOBBER && LRA_TEMP_CLOBBER_P (pat)) + if (GET_CODE (pat) == CLOBBER + && (LRA_TEMP_CLOBBER_P (pat) + || ((!MEM_P (XEXP (pat, 0)) + || GET_MODE (XEXP (pat, 0)) != BLKmode + || (GET_CODE (XEXP (XEXP (pat, 0), 0)) != SCRATCH + && XEXP (XEXP (pat, 0), 0) != stack_pointer_rtx)) + && (!REG_P (XEXP (pat, 0)) + || !REG_FUNCTION_VALUE_P (XEXP (pat, 0)))))) { - /* Remove clobbers temporarily created in LRA. We don't - need them anymore and don't want to waste compiler + /* Remove clobbers temporarily created in LRA and clobbers with + registers spilled to memory except those that refer to the + return value and the special mem:BLK CLOBBERs added to prevent + the scheduler from misarranging variable-array code. + We don't need them anymore and don't want to waste compiler time processing them in a few subsequent passes. */ lra_invalidate_insn_data (insn); delete_insn (insn);