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-4905] path solver: Prefer range_of_expr instead of range_on_edge. Date: Thu, 4 Nov 2021 14:40:54 +0000 (GMT) [thread overview] Message-ID: <20211104144054.AD6983857C5E@sourceware.org> (raw) https://gcc.gnu.org/g:6a9678f0b30d36ae13259ad635e175a1e24917a1 commit r12-4905-g6a9678f0b30d36ae13259ad635e175a1e24917a1 Author: Aldy Hernandez <aldyh@redhat.com> Date: Thu Nov 4 12:37:16 2021 +0100 path solver: Prefer range_of_expr instead of range_on_edge. The range_of_expr method provides better caching than range_on_edge. If we have a statement, we can just it and avoid the range_on_edge dance. Plus we can use all the range_of_expr fanciness. Tested on x86-64 and ppc64le Linux with the usual regstrap. I also verified that the before and after number of threads was the same or greater in a suite of .ii files from a bootstrap. gcc/ChangeLog: PR tree-optimization/102943 * gimple-range-path.cc (path_range_query::range_on_path_entry): Prefer range_of_expr unless there are no statements in the BB. Diff: --- gcc/gimple-range-path.cc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/gcc/gimple-range-path.cc b/gcc/gimple-range-path.cc index 42309886c94..9175651e896 100644 --- a/gcc/gimple-range-path.cc +++ b/gcc/gimple-range-path.cc @@ -135,10 +135,24 @@ void path_range_query::range_on_path_entry (irange &r, tree name) { gcc_checking_assert (defined_outside_path (name)); - int_range_max tmp; basic_block entry = entry_bb (); - bool changed = false; + // Prefer to use range_of_expr if we have a statement to look at, + // since it has better caching than range_on_edge. + gimple *last = last_stmt (entry); + if (last) + { + if (m_ranger.range_of_expr (r, name, last)) + return; + gcc_unreachable (); + } + + // If we have no statement, look at all the incoming ranges to the + // block. This can happen when we're querying a block with only an + // outgoing edge (no statement but the fall through edge), but for + // which we can determine a range on entry to the block. + int_range_max tmp; + bool changed = false; r.set_undefined (); for (unsigned i = 0; i < EDGE_COUNT (entry->preds); ++i) {
reply other threads:[~2021-11-04 14:40 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=20211104144054.AD6983857C5E@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).