public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: gcc-patches@gcc.gnu.org, d@dcepelik.cz
Subject: Improve tree-ssa-alias dump files
Date: Sat, 10 Oct 2020 19:42:58 +0200	[thread overview]
Message-ID: <20201010174258.GA35127@kam.mff.cuni.cz> (raw)

Hi,
this patch improves debug info of modref so it is easier to track down
misoptimizations.

Bootstrapped/regtested x86_64-linux, comitted.

Honza

gcc/ChangeLog:

2020-10-10  Jan Hubicka  <hubicka@ucw.cz>

	* tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Improve debug dumps.
	(call_may_clobber_ref_p_1): Improve debug dumps.

diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index ac7e020c5e2..877e4999f0f 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -43,6 +43,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "attr-fnspec.h"
 #include "errors.h"
 #include "dbgcnt.h"
+#include "gimple-pretty-print.h"
 
 /* Broad overview of how alias analysis on gimple works:
 
@@ -2610,13 +2611,23 @@ ref_maybe_used_by_call_p_1 (gcall *call, ao_ref *ref, bool tbaa_p)
 		  alias_stats.modref_use_no_alias++;
 		  if (dump_file && (dump_flags & TDF_DETAILS))
 		    {
-		      fprintf (dump_file, "ipa-modref: in %s,"
-			       " call to %s does not use ",
-			       cgraph_node::get
-				   (current_function_decl)->dump_name (),
+		      fprintf (dump_file,
+			       "ipa-modref: call stmt ");
+		      print_gimple_stmt (dump_file, call, 0);
+		      fprintf (dump_file,
+			       "ipa-modref: call to %s does not use ",
 			       node->dump_name ());
-		      print_generic_expr (dump_file, ref->ref);
-		      fprintf (dump_file, " %i->%i\n",
+		      if (!ref->ref && ref->base)
+			{
+			  fprintf (dump_file, "base: ");
+			  print_generic_expr (dump_file, ref->base);
+			}
+		      else if (ref->ref)
+			{
+			  fprintf (dump_file, "ref: ");
+			  print_generic_expr (dump_file, ref->ref);
+			}
+		      fprintf (dump_file, " alias sets: %i->%i\n",
 			       ao_ref_base_alias_set (ref),
 			       ao_ref_alias_set (ref));
 		    }
@@ -3035,13 +3046,22 @@ call_may_clobber_ref_p_1 (gcall *call, ao_ref *ref, bool tbaa_p)
 		  if (dump_file && (dump_flags & TDF_DETAILS))
 		    {
 		      fprintf (dump_file,
-			       "ipa-modref: in %s, "
-			       "call to %s does not clobber ",
-			       cgraph_node::get
-				  (current_function_decl)->dump_name (),
+			       "ipa-modref: call stmt ");
+		      print_gimple_stmt (dump_file, call, 0);
+		      fprintf (dump_file,
+			       "ipa-modref: call to %s does not clobber ",
 			       node->dump_name ());
-		      print_generic_expr (dump_file, ref->ref);
-		      fprintf (dump_file, " %i->%i\n",
+		      if (!ref->ref && ref->base)
+			{
+			  fprintf (dump_file, "base: ");
+			  print_generic_expr (dump_file, ref->base);
+			}
+		      else if (ref->ref)
+			{
+			  fprintf (dump_file, "ref: ");
+			  print_generic_expr (dump_file, ref->ref);
+			}
+		      fprintf (dump_file, " alias sets: %i->%i\n",
 			       ao_ref_base_alias_set (ref),
 			       ao_ref_alias_set (ref));
 		    }

                 reply	other threads:[~2020-10-10 17:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20201010174258.GA35127@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=d@dcepelik.cz \
    --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).