With the new s390 split-stack support, when optimization is enabled, the cold path of calling __morestack is likely to be moved to the end of the function. This will result in the function ending in split_stack_call_esa, which is an unconditional jump instruction and part of the function prologue. reposition_prologue_and_epilogue_notes will insert NOTE_INSN_PROLOGUE_END right after it (and before the following barrier), causing a verification error. Insert it after the barrier instead (and outside of basic block).
gcc/ChangeLog: * function.c (reposition_prologue_and_epilogue_notes): Avoid verification error if the last insn of prologue is an unconditional jump. --- gcc/ChangeLog | 6 ++++++ gcc/function.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6aef3f9..56e31f6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2016-01-02 Marcin Kościelnicki <koria...@0x04.net> + * function.c (reposition_prologue_and_epilogue_notes): Avoid + verification error if the last insn of prologue is an unconditional + jump. + +2016-01-02 Marcin Kościelnicki <koria...@0x04.net> + * config/s390/s390.c (s390_asm_declare_function_size): Add code to actually emit the .size directive. diff --git a/gcc/function.c b/gcc/function.c index 035a49e..921945f 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -6348,6 +6348,12 @@ reposition_prologue_and_epilogue_notes (void) /* Avoid placing note between CODE_LABEL and BASIC_BLOCK note. */ if (LABEL_P (last)) last = NEXT_INSN (last); + if (BARRIER_P (last) && BLOCK_FOR_INSN (note)) + { + if (BB_END (BLOCK_FOR_INSN (note)) == note) + BB_END (BLOCK_FOR_INSN (note)) = PREV_INSN (note); + BLOCK_FOR_INSN (note) = 0; + } reorder_insns (note, note, last); } } -- 2.6.4