The thread_prologue_and_epilogue_insns code that used to be protected by #ifdef HAVE_eh_return is unconditionally correct and isn't on any kind of hot path (it's only run once per function).
Bootstrapped & regression-tested on x86_64-linux-gnu and aarch64-linux-gnu. Also tested via config-list.mk. Committed as preapproved. Thanks, Richard gcc/ * target-insns.def (eh_return): New targetm instruction pattern. * except.c (expand_eh_return): Use it instead of HAVE_*/gen_* interface. * function.c (thread_prologue_and_epilogue_insns): Remove preprocessor condition. Index: gcc/target-insns.def =================================================================== --- gcc/target-insns.def 2015-06-28 12:00:27.698196372 +0100 +++ gcc/target-insns.def 2015-06-28 12:00:31.448043556 +0100 @@ -39,6 +39,7 @@ DEF_TARGET_INSN (check_stack, (rtx x0)) DEF_TARGET_INSN (clear_cache, (rtx x0, rtx x1)) DEF_TARGET_INSN (doloop_begin, (rtx x0, rtx x1)) DEF_TARGET_INSN (doloop_end, (rtx x0, rtx x1)) +DEF_TARGET_INSN (eh_return, (rtx x0)) DEF_TARGET_INSN (epilogue, (void)) DEF_TARGET_INSN (exception_receiver, (void)) DEF_TARGET_INSN (extv, (rtx x0, rtx x1, rtx x2, rtx x3)) Index: gcc/except.c =================================================================== --- gcc/except.c 2015-06-28 12:00:27.698196372 +0100 +++ gcc/except.c 2015-06-28 12:00:31.449043515 +0100 @@ -2271,11 +2271,9 @@ expand_eh_return (void) emit_move_insn (EH_RETURN_STACKADJ_RTX, crtl->eh.ehr_stackadj); #endif -#ifdef HAVE_eh_return - if (HAVE_eh_return) - emit_insn (gen_eh_return (crtl->eh.ehr_handler)); + if (targetm.have_eh_return ()) + emit_insn (targetm.gen_eh_return (crtl->eh.ehr_handler)); else -#endif { #ifdef EH_RETURN_HANDLER_RTX emit_move_insn (EH_RETURN_HANDLER_RTX, crtl->eh.ehr_handler); Index: gcc/function.c =================================================================== --- gcc/function.c 2015-06-28 12:00:27.698196372 +0100 +++ gcc/function.c 2015-06-28 12:00:31.447043596 +0100 @@ -5963,7 +5963,6 @@ thread_prologue_and_epilogue_insns (void uses the flag in the meantime. */ epilogue_completed = 1; -#ifdef HAVE_eh_return /* Find non-fallthru edges that end with EH_RETURN instructions. On some targets, these get split to a special version of the epilogue code. In order to be able to properly annotate these with unwind @@ -5987,7 +5986,6 @@ thread_prologue_and_epilogue_insns (void record_insns (NEXT_INSN (prev), NEXT_INSN (trial), &epilogue_insn_hash); emit_note_after (NOTE_INSN_EPILOGUE_BEG, prev); } -#endif /* If nothing falls through into the exit block, we don't need an epilogue. */