Hi! On Tue, Sep 22, 2020 at 09:55:12AM +0930, Alan Modra wrote: > Calls from split-stack code to non-split-stack code need to expand > mapped stack memory via __morestack. Even tail calls. > > __morestack is quite a surprising function on powerpc in that it calls > back to its caller, and a tail call will continue running in the > context of extra mapped stack.
Also known as "pure evil" :-) > PR target/97107 > * config/rs6000/rs6000-internal.h (struct rs6000_stack): Improve > calls_p comment. > * config/rs6000/rs6000-logue.c (rs6000_stack_info): Likewise. > (rs6000_expand_split_stack_prologue): Emit the prologue for > functions that make a sibling call. > if (!info->push_p) > - return; > + { > + /* We need the -fsplit-stack prologue for functions that make > + tail calls. Tail calls don't count against crtl->is_leaf. */ > + for (insn = get_topmost_sequence ()->first; insn; insn = NEXT_INSN > (insn)) > + if (CALL_P (insn)) > + break; > + if (!insn) > + return; > + } I don't think that get_topmost_sequence is correct. Other than that this is fine for trunk (and backports). Thanks! Segher