tailc, expand: Small incremental tweak to tail call dump [PR119718]

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]

2025-04-12  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/119718
	* tree-tailcall.cc (maybe_error_musttail): Dump the GIMPLE at the
	end of the Cannot tail-call line rather than on the line before it.
	* calls.cc (maybe_complain_about_tail_call): Dump the GENERIC
	at the end of the ;; Cannot tail-call line rather than on the
	line before it.
This commit is contained in:
Jakub Jelinek 2025-04-12 13:12:56 +02:00 committed by Jakub Jelinek
parent 0562e17bd0
commit 7e91bba6d5
2 changed files with 3 additions and 3 deletions

View file

@ -1282,9 +1282,9 @@ maybe_complain_about_tail_call (tree call_expr, const char *reason)
&& dump_file
&& (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, ";; ");
fprintf (dump_file, ";; Cannot tail-call: %s: ", reason);
print_generic_expr (dump_file, call_expr, TDF_SLIM);
fprintf (dump_file, "\n;; Cannot tail-call: %s\n", reason);
fprintf (dump_file, "\n");
}
}

View file

@ -494,8 +494,8 @@ maybe_error_musttail (gcall *call, const char *err, bool diag_musttail)
}
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Cannot tail-call: %s: ", err);
print_gimple_stmt (dump_file, call, 0, TDF_SLIM);
fprintf (dump_file, "Cannot tail-call: %s\n", err);
}
}