public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@linux.intel.com>
To: gcc-patches@gcc.gnu.org
Cc: Andi Kleen <ak@linux.intel.com>
Subject: [PATCH v8 11/12] Dump reason for missing tail call into dump file
Date: Sat, 22 Jun 2024 11:54:43 -0700	[thread overview]
Message-ID: <20240622185557.1589179-12-ak@linux.intel.com> (raw)
In-Reply-To: <20240622185557.1589179-1-ak@linux.intel.com>

gcc/ChangeLog:

	* tree-tailcall.cc (maybe_error_musttail): Print reason to
        dump_file.
	(find_tail_calls): Print gimple stmt or other reasons that stop
        the search for tail calls into dump file.
---
 gcc/tree-tailcall.cc | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/gcc/tree-tailcall.cc b/gcc/tree-tailcall.cc
index a77fa1511415..f69a9ad40bda 100644
--- a/gcc/tree-tailcall.cc
+++ b/gcc/tree-tailcall.cc
@@ -442,6 +442,11 @@ maybe_error_musttail (gcall *call, const char *err)
       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);
+    }
 }
 
 /* Count succ edges for BB and return in NUM_OTHER and NUM_EH.  */
@@ -492,7 +497,12 @@ find_tail_calls (basic_block bb, struct tailcall **ret, bool only_musttail,
       /* Allow EH edges so that we can give a better
 	 error message later.  */
       if (num_other != 1)
-	return;
+	{
+	  if (dump_file)
+	    fprintf (dump_file, "Basic block %d has %d eh / %d other edges\n",
+			   bb->index, num_eh, num_other);
+	  return;
+	}
     }
 
   bool bad_stmt = false;
@@ -537,6 +547,11 @@ find_tail_calls (basic_block bb, struct tailcall **ret, bool only_musttail,
       if (gimple_references_memory_p (stmt)
 	  || gimple_has_volatile_ops (stmt))
 	{
+	  if (dump_file)
+	    {
+	      fprintf (dump_file, "Cannot handle ");
+	      print_gimple_stmt (dump_file, stmt, 0);
+	    }
 	  bad_stmt = true;
 	}
     }
-- 
2.45.2


  parent reply	other threads:[~2024-06-22 18:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-22 18:54 Updated musttail patchkit Andi Kleen
2024-06-22 18:54 ` [PATCH v8 01/12] Improve must tail in RTL backend Andi Kleen
2024-06-22 18:54 ` [PATCH v8 02/12] Fix pro_and_epilogue for sibcalls at -O0 Andi Kleen
2024-06-22 18:54 ` [PATCH v8 03/12] Add a musttail generic attribute to the c-attribs table Andi Kleen
2024-06-22 18:54 ` [PATCH v8 04/12] C++: Support clang compatible [[musttail]] (PR83324) Andi Kleen
2024-06-22 18:54 ` [PATCH v8 05/12] C: Implement musttail attribute for returns Andi Kleen
2024-06-22 18:54 ` [PATCH v8 06/12] Add tests for C/C++ musttail attributes Andi Kleen
2024-06-22 18:54 ` [PATCH v8 07/12] Enable musttail tail conversion even when not optimizing Andi Kleen
2024-06-22 18:54 ` [PATCH v8 08/12] Give better error messages for musttail Andi Kleen
2024-06-22 18:54 ` [PATCH v8 09/12] Delay caller error reporting " Andi Kleen
2024-06-22 18:54 ` [PATCH v8 10/12] Add documentation for musttail attribute Andi Kleen
2024-06-22 18:54 ` Andi Kleen [this message]
2024-06-22 18:54 ` [PATCH v8 12/12] Mark expand musttail error messages for translation Andi Kleen
2024-07-01 16:23 ` [PING] Re: Updated musttail patchkit Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240622185557.1589179-12-ak@linux.intel.com \
    --to=ak@linux.intel.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).