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-5068] Return NULL for maybe_register_path when unprofitable. Date: Tue, 9 Nov 2021 17:23:51 +0000 (GMT) [thread overview] Message-ID: <20211109172351.57EE13858430@sourceware.org> (raw) https://gcc.gnu.org/g:2b59cf475a06f37c2b49631043f2896455923c3c commit r12-5068-g2b59cf475a06f37c2b49631043f2896455923c3c Author: Aldy Hernandez <aldyh@redhat.com> Date: Tue Nov 9 10:45:26 2021 +0100 Return NULL for maybe_register_path when unprofitable. This is a minor cleanup for maybe_register_path to return NULL when the path is unprofitable. It is needed for a follow-up patch to generate better dumps from the threader. There is no change in behavior, since the only call to this function bails on !profitable_path_p. Tested on x86-64 Linux. gcc/ChangeLog: * tree-ssa-threadbackward.c (back_threader::maybe_register_path): Return NULL when unprofitable. Diff: --- gcc/tree-ssa-threadbackward.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/gcc/tree-ssa-threadbackward.c b/gcc/tree-ssa-threadbackward.c index f9485bf9046..84249544760 100644 --- a/gcc/tree-ssa-threadbackward.c +++ b/gcc/tree-ssa-threadbackward.c @@ -186,11 +186,10 @@ back_threader::debug_counter () return true; } -// Register the current path for jump threading if it's profitable to -// do so. // -// Return the known taken edge out of the path, even if the path was -// not registered, or NULL if the taken edge could not be determined. +// Return NULL if it is unprofitable to thread this path, or the +// outgoing edge is unknown. Return UNREACHABLE_EDGE if the path is +// unreachable. edge back_threader::maybe_register_path () @@ -199,23 +198,26 @@ back_threader::maybe_register_path () if (taken_edge && taken_edge != UNREACHABLE_EDGE) { - // Avoid circular paths. if (m_visited_bbs.contains (taken_edge->dest)) - return UNREACHABLE_EDGE; - - bool irreducible = false; - bool profitable - = m_profit.profitable_path_p (m_path, m_name, taken_edge, &irreducible); - - if (profitable) { - if (!debug_counter ()) - return NULL; - - m_registry.register_path (m_path, taken_edge); + // Avoid circular paths by indicating there is nothing to + // see in this direction. + taken_edge = UNREACHABLE_EDGE; + } + else + { + bool irreducible = false; + if (m_profit.profitable_path_p (m_path, m_name, taken_edge, + &irreducible) + && debug_counter ()) + { + m_registry.register_path (m_path, taken_edge); - if (irreducible) - vect_free_loop_info_assumptions (m_path[0]->loop_father); + if (irreducible) + vect_free_loop_info_assumptions (m_path[0]->loop_father); + } + else + taken_edge = NULL; } } return taken_edge;
reply other threads:[~2021-11-09 17: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=20211109172351.57EE13858430@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).