From: Uros Bizjak Date: Sun, 6 Aug 2017 15:48:37 +0000 (+0200) Subject: alpha.c (alpha_reorg): If trap is the last active insn in the function, emit NOP... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cc8a9b8755bf92899be8a936b1a1229e06e942fd;p=gcc.git alpha.c (alpha_reorg): If trap is the last active insn in the function, emit NOP after the insn. * config/alpha/alpha.c (alpha_reorg): If trap is the last active insn in the function, emit NOP after the insn. From-SVN: r250901 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 51ed7c99162..4ed00a29bb0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-08-06 Uros Bizjak + + * config/alpha/alpha.c (alpha_reorg): If trap is the last active + insn in the function, emit NOP after the insn. + 2017-08-06 Tom de Vries * omp-expand.c (expand_oacc_for): Add missing edge probability for tile diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 9f5dae29054..341ec20d340 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -9456,6 +9456,25 @@ And in the noreturn case: if (current_function_has_exception_handlers ()) alpha_pad_function_end (); + + /* CALL_PAL that implements trap insn, updates program counter to point + after the insn. In case trap is the last insn in the function, + emit NOP to guarantee that PC remains inside function boundaries. + This workaround is needed to get reliable backtraces. */ + + rtx_insn *insn = prev_active_insn (get_last_insn ()); + + if (insn && NONJUMP_INSN_P (insn)) + { + rtx pat = PATTERN (insn); + if (GET_CODE (pat) == PARALLEL) + { + rtx vec = XVECEXP (pat, 0, 0); + if (GET_CODE (vec) == TRAP_IF + && XEXP (vec, 0) == const1_rtx) + emit_insn_after (gen_unop (), insn); + } + } } static void