public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-3342] Improve backwards threader debugging dumps. Date: Fri, 3 Sep 2021 15:23:11 +0000 (GMT) [thread overview] Message-ID: <20210903152311.B03CC384842E@sourceware.org> (raw) https://gcc.gnu.org/g:779275c0835b58325f806568836c8b5081d1f52f commit r12-3342-g779275c0835b58325f806568836c8b5081d1f52f Author: Aldy Hernandez <aldyh@redhat.com> Date: Fri Sep 3 10:57:33 2021 +0200 Improve backwards threader debugging dumps. This patch adds debugging helpers to the backwards threader. I have also noticed that profitable_path_p() can bail early on paths that crosses loops and leave the dump of blocks incomplete. Fixed as well. Unfortunately the new methods cannot be marked const, because we call the solver's dump which is not const. I believe this was because the ranger dump calls m_cache.block_range(). This could probably use a cleanup at a later time. Tested on x86-64 Linux. gcc/ChangeLog: * tree-ssa-threadbackward.c (back_threader::dump): New. (back_threader::debug): New. (back_threader_profitability::profitable_path_p): Dump blocks even if we are bailing early. Diff: --- gcc/tree-ssa-threadbackward.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/gcc/tree-ssa-threadbackward.c b/gcc/tree-ssa-threadbackward.c index 3aad1493c4d..b9a0d9a60ad 100644 --- a/gcc/tree-ssa-threadbackward.c +++ b/gcc/tree-ssa-threadbackward.c @@ -42,6 +42,7 @@ along with GCC; see the file COPYING3. If not see #include "gimple-range-path.h" #include "ssa.h" #include "tree-cfgcleanup.h" +#include "tree-pretty-print.h" // Path registry for the backwards threader. After all paths have been // registered with register_path(), thread_through_all_blocks() is called @@ -89,6 +90,8 @@ private: edge find_taken_edge (const vec<basic_block> &path); edge find_taken_edge_cond (const vec<basic_block> &path, gcond *); edge find_taken_edge_switch (const vec<basic_block> &path, gswitch *); + virtual void debug (); + virtual void dump (FILE *out); back_threader_registry m_registry; back_threader_profitability m_profit; @@ -519,6 +522,30 @@ debug (const vec <basic_block> &path) dump_path (stderr, path); } +void +back_threader::dump (FILE *out) +{ + m_solver.dump (out); + fprintf (out, "\nCandidates for pre-computation:\n"); + fprintf (out, "===================================\n"); + + bitmap_iterator bi; + unsigned i; + + EXECUTE_IF_SET_IN_BITMAP (m_imports, 0, i, bi) + { + tree name = ssa_name (i); + print_generic_expr (out, name, TDF_NONE); + fprintf (out, "\n"); + } +} + +void +back_threader::debug () +{ + dump (stderr); +} + back_threader_registry::back_threader_registry (int max_allowable_paths) : m_max_allowable_paths (max_allowable_paths) { @@ -607,6 +634,14 @@ back_threader_profitability::profitable_path_p (const vec<basic_block> &m_path, if (bb->loop_father != loop) { path_crosses_loops = true; + + // Dump rest of blocks. + if (dump_file && (dump_flags & TDF_DETAILS)) + for (j++; j < m_path.length (); j++) + { + bb = m_path[j]; + fprintf (dump_file, " bb:%i", bb->index); + } break; }
reply other threads:[~2021-09-03 15:23 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=20210903152311.B03CC384842E@sourceware.org \ --to=aldyh@gcc.gnu.org \ --cc=gcc-cvs@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: linkBe 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).