From: Aldy Hernandez <aldyh@redhat.com>
To: GCC patches <gcc-patches@gcc.gnu.org>
Subject: [COMMITTED] Include PHI threading restrictions in backthreader diagnostics.
Date: Wed, 10 Nov 2021 07:48:20 +0100 [thread overview]
Message-ID: <20211110064820.445504-1-aldyh@redhat.com> (raw)
I forgot to include the path dump when failing a path in resolve_phi.
To do so I abstracted dump_path into its own function, which made me
realize we had another copy with slightly different output.
I've merged everything and cleaned it up.
Tested on x86-64 Linux.
gcc/ChangeLog:
* tree-ssa-threadbackward.c
(back_threader::maybe_register_path_dump): Abstract path dumping...
(dump_path): ...here.
(back_threader::resolve_phi): Call dump_path.
(debug): Same.
---
gcc/tree-ssa-threadbackward.c | 47 ++++++++++++++++-------------------
1 file changed, 22 insertions(+), 25 deletions(-)
diff --git a/gcc/tree-ssa-threadbackward.c b/gcc/tree-ssa-threadbackward.c
index 74b5f361f45..0f7b4a732eb 100644
--- a/gcc/tree-ssa-threadbackward.c
+++ b/gcc/tree-ssa-threadbackward.c
@@ -187,6 +187,18 @@ back_threader::debug_counter ()
return true;
}
+static void
+dump_path (FILE *dump_file, const vec<basic_block> &path)
+{
+ for (unsigned i = path.length (); i > 0; --i)
+ {
+ basic_block bb = path[i - 1];
+ fprintf (dump_file, "%d", bb->index);
+ if (i > 1)
+ fprintf (dump_file, "->");
+ }
+}
+
// Dump details of an attempt to register a path.
void
@@ -196,14 +208,7 @@ back_threader::maybe_register_path_dump (edge taken)
return;
fprintf (dump_file, "path: ");
-
- for (unsigned i = m_path.length (); i > 0; --i)
- {
- basic_block bb = m_path[i - 1];
- fprintf (dump_file, "%d", bb->index);
- if (i > 1)
- fprintf (dump_file, "->");
- }
+ dump_path (dump_file, m_path);
fprintf (dump_file, "->");
if (taken == UNREACHABLE_EDGE)
@@ -368,9 +373,14 @@ back_threader::resolve_phi (gphi *phi, bitmap interesting)
if (!profitable_p)
{
if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file,
- " FAIL: path through PHI in bb%d (incoming bb:%d) crosses loop\n",
- e->dest->index, e->src->index);
+ {
+ fprintf (dump_file,
+ " FAIL: path through PHI in bb%d (incoming bb:%d) crosses loop\n",
+ e->dest->index, e->src->index);
+ fprintf (dump_file, "path: %d->", e->src->index);
+ dump_path (dump_file, m_path);
+ fprintf (dump_file, "->xx REJECTED\n");
+ }
continue;
}
@@ -558,24 +568,11 @@ back_threader::maybe_thread_block (basic_block bb)
find_paths (bb, name);
}
-// Dump a sequence of BBs through the CFG.
-
-DEBUG_FUNCTION void
-dump_path (FILE *dump_file, const vec<basic_block> &path)
-{
- for (size_t i = 0; i < path.length (); ++i)
- {
- fprintf (dump_file, "BB%d", path[i]->index);
- if (i + 1 < path.length ())
- fprintf (dump_file, " <- ");
- }
- fprintf (dump_file, "\n");
-}
-
DEBUG_FUNCTION void
debug (const vec <basic_block> &path)
{
dump_path (stderr, path);
+ fputc ('\n', stderr);
}
void
--
2.31.1
reply other threads:[~2021-11-10 6:48 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=20211110064820.445504-1-aldyh@redhat.com \
--to=aldyh@redhat.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).