While trying to reduce musttail failures, I noticed
that it was hard to figure out if `Cannot convert` message
was on a musttail call or just a normal call. This adds
extra messages to the dump debug to signify it was a musttail
call and if we are going to remove the musttail from it too.

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

        * tree-tailcall.cc (maybe_error_musttail): Move the print
        to the dump file to begining of the function. Also expand dump
        to include more information.

Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>
---
 gcc/tree-tailcall.cc | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/gcc/tree-tailcall.cc b/gcc/tree-tailcall.cc
index 3efbe9042f2..b72ca6d8d8f 100644
--- a/gcc/tree-tailcall.cc
+++ b/gcc/tree-tailcall.cc
@@ -441,6 +441,17 @@ propagate_through_phis (tree var, edge e)
 static void
 maybe_error_musttail (gcall *call, const char *err, bool diag_musttail)
 {
+  if (dump_file)
+    {
+      print_gimple_stmt (dump_file, call, 0, TDF_SLIM);
+      fprintf (dump_file, "Cannot convert: %s\n", err);
+      if (gimple_call_must_tail_p (call))
+       {
+         fprintf (dump_file, "was musttail.\n");
+         if (diag_musttail)
+           fprintf (dump_file, "turned off musttail\n");
+       }
+    }
   if (gimple_call_must_tail_p (call) && diag_musttail)
     {
       error_at (call->location, "cannot tail-call: %s", err);
@@ -451,11 +462,6 @@ maybe_error_musttail (gcall *call, const char *err, bool 
diag_musttail)
       gimple_call_set_must_tail (call, false); /* Avoid another error.  */
       gimple_call_set_tail (call, false);
     }
-  if (dump_file)
-    {
-      print_gimple_stmt (dump_file, call, 0, TDF_SLIM);
-      fprintf (dump_file, "Cannot convert: %s\n", err);
-    }
 }
 
 /* Argument for compute_live_vars/live_vars_at_stmt and what compute_live_vars
-- 
2.43.0

Reply via email to