From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2136) id D55DF3858404; Wed, 10 Nov 2021 06:48:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D55DF3858404 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Aldy Hernandez To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-5081] Include PHI threading restrictions in backthreader diagnostics. X-Act-Checkin: gcc X-Git-Author: Aldy Hernandez X-Git-Refname: refs/heads/master X-Git-Oldrev: 60e3179b7a33a62f36a143f9168ba2f777e37864 X-Git-Newrev: a2ab1a5adee9d316e54917669ca88befb43c29b7 Message-Id: <20211110064833.D55DF3858404@sourceware.org> Date: Wed, 10 Nov 2021 06:48:33 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Nov 2021 06:48:33 -0000 https://gcc.gnu.org/g:a2ab1a5adee9d316e54917669ca88befb43c29b7 commit r12-5081-ga2ab1a5adee9d316e54917669ca88befb43c29b7 Author: Aldy Hernandez Date: Tue Nov 9 17:55:52 2021 +0100 Include PHI threading restrictions in backthreader diagnostics. 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. 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. Diff: --- 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 &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 &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 &path) { dump_path (stderr, path); + fputc ('\n', stderr); } void