public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Andrew Macleod <amacleod@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3594] Allow queries on exit block. Date: Tue, 1 Nov 2022 13:19:07 +0000 (GMT) [thread overview] Message-ID: <20221101131907.688943858C5E@sourceware.org> (raw) https://gcc.gnu.org/g:592bbe3d7eb3cff656c731e84ad872719a4a9d16 commit r13-3594-g592bbe3d7eb3cff656c731e84ad872719a4a9d16 Author: Andrew MacLeod <amacleod@redhat.com> Date: Mon Oct 31 10:56:25 2022 -0400 Allow queries on exit block. Ranger was not allowing the exit block to be queried for range_on_entry or exit. This removes that restriction. * gimple-range-cache.cc (ranger_cache::fill_block_cache): Allow exit block to be specified. (ranger_cache::range_from_dom): If exit block is specified, use the immediate predecessor instead of the dominator to start. * gimple-range.cc (gimple_ranger::range_on_exit): Allow query for exit block. Diff: --- gcc/gimple-range-cache.cc | 16 ++++++++++------ gcc/gimple-range.cc | 1 - 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc index f279371948a..89e2403acce 100644 --- a/gcc/gimple-range-cache.cc +++ b/gcc/gimple-range-cache.cc @@ -1193,9 +1193,8 @@ ranger_cache::fill_block_cache (tree name, basic_block bb, basic_block def_bb) Value_Range block_result (type); Value_Range undefined (type); - // At this point we shouldn't be looking at the def, entry or exit block. - gcc_checking_assert (bb != def_bb && bb != ENTRY_BLOCK_PTR_FOR_FN (cfun) && - bb != EXIT_BLOCK_PTR_FOR_FN (cfun)); + // At this point we shouldn't be looking at the def, entry block. + gcc_checking_assert (bb != def_bb && bb != ENTRY_BLOCK_PTR_FOR_FN (cfun)); gcc_checking_assert (m_workback.length () == 0); // If the block cache is set, then we've already visited this block. @@ -1434,10 +1433,15 @@ ranger_cache::range_from_dom (vrange &r, tree name, basic_block start_bb, // Default value is global range. get_global_range (r, name); + // The dominator of EXIT_BLOCK doesn't seem to be set, so at least handle + // the common single exit cases. + if (start_bb == EXIT_BLOCK_PTR_FOR_FN (cfun) && single_pred_p (start_bb)) + bb = single_pred_edge (start_bb)->src; + else + bb = get_immediate_dominator (CDI_DOMINATORS, start_bb); + // Search until a value is found, pushing blocks which may need calculating. - for (bb = get_immediate_dominator (CDI_DOMINATORS, start_bb); - bb; - prev_bb = bb, bb = get_immediate_dominator (CDI_DOMINATORS, bb)) + for ( ; bb; prev_bb = bb, bb = get_immediate_dominator (CDI_DOMINATORS, bb)) { // Accumulate any block exit inferred ranges. m_exit.maybe_adjust_range (infer, name, bb); diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc index 058439733ee..110cf574454 100644 --- a/gcc/gimple-range.cc +++ b/gcc/gimple-range.cc @@ -167,7 +167,6 @@ void gimple_ranger::range_on_exit (vrange &r, basic_block bb, tree name) { // on-exit from the exit block? - gcc_checking_assert (bb != EXIT_BLOCK_PTR_FOR_FN (cfun)); gcc_checking_assert (gimple_range_ssa_p (name)); unsigned idx;
reply other threads:[~2022-11-01 13:19 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=20221101131907.688943858C5E@sourceware.org \ --to=amacleod@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).