On Tue, May 14, 2024 at 6:30 PM Andi Kleen <a...@linux.intel.com> wrote: > > > Looks generally OK though does this mean people can debug > > programs using [[gnu::musttail]] only with optimized builds? It > > seems to me we should try harder to make [[gnu::musttail]] work > > at -O0 and generally behave the same at all optimization levels? > > Yes that's a fair point. The problem is tree-tailcall failing, > not the RTL backend. Have to see what it would take to fix. I would > prefer to do this as a followon patch though.
Btw, -Og also doesn't run the tail-calls pass. I think we should at least try to run the pass at -Og and -O0 somewhere before pass_expand and in find_tail_calls simply only consider the musttail annotated calls in this case? It should be reasonably cheap to walk the return stmts of each function. I'm not sure why we run pass_tail_calls so "early" and within the regular post-IPA optimization pipeline rather than in the pre-expand set of passes common to all optimization levels. Possibly simply moving the pass works out already. Richard. > > -Andi