On Fri, Apr 11, 2025 at 12:00:27PM -0700, Andrew Pinski wrote: > On Fri, Apr 11, 2025 at 11:54 AM Jakub Jelinek <ja...@redhat.com> wrote: > > > > Hi! > > > > Here is an optional incremental tweak to the previous patch. > > Instead of > > > > ./xgcc -B ./ -S -O2 -fdump-{tree-tailc,rtl-expand}-details pr119718.c ; > > grep -B1 '^\(;; \)\?Cannot tail-call:' pr119718.c.* > > pr119718.c.222t.tailc-_7 = bar (0); > > pr119718.c.222t.tailc:Cannot tail-call: call invocation refers to locals > > -- > > pr119718.c.270r.expand-;; foo (1, 2, 3, 4, 5, 6, 7) [tail call] > > pr119718.c.270r.expand:;; Cannot tail-call: callee required more stack > > slots than the caller > > > > this dumps > > > > ./xgcc -B ./ -S -O2 -fdump-{tree-tailc,rtl-expand}-details pr119718.c ; > > grep '^\(;; \)\?Cannot tail-call:' pr119718.c.* > > pr119718.c.222t.tailc:Cannot tail-call: call invocation refers to locals: > > _7 = bar (0); > > pr119718.c.270r.expand:;; Cannot tail-call: callee required more stack > > slots than the caller: foo (1, 2, 3, 4, 5, 6, 7) [tail call] > > > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > This looks good to me. I had a patch which helped me with debugging > musttail failures too that conflicts slightly with this one: > https://gcc.gnu.org/pipermail/gcc-patches/2025-March/679386.html
Whether a call was musttail or not should be in that dump, [must tail call] or not, at least from print_gimple_stmt. Maybe print_generic_stmt doesn't do that, in that case perhaps that should be changed. Totally untested: 2025-04-11 Jakub Jelinek <ja...@redhat.com> * tree-pretty-print.cc (dump_generic_node) <case CALL_EXPR>: Dump also CALL_EXPR_MUST_TAIL_CALL flag. --- gcc/tree-pretty-print.cc.jj 2025-04-08 14:09:27.132782349 +0200 +++ gcc/tree-pretty-print.cc 2025-04-11 21:11:46.981321750 +0200 @@ -3201,6 +3201,8 @@ dump_generic_node (pretty_printer *pp, t pp_string (pp, " [return slot optimization]"); if (CALL_EXPR_TAILCALL (node)) pp_string (pp, " [tail call]"); + if (CALL_EXPR_MUST_TAIL_CALL (node)) + pp_string (pp, " [must tail call]"); break; case WITH_CLEANUP_EXPR: Jakub