public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/marxin/heads/loop-unswitching-switch-v5)] Use global ranger. Date: Mon, 8 Nov 2021 15:30:44 +0000 (GMT) [thread overview] Message-ID: <20211108153044.B2825385842E@sourceware.org> (raw) https://gcc.gnu.org/g:5df2804ff8197cfd7d45a9e28ee9d22ad1e6a3a5 commit 5df2804ff8197cfd7d45a9e28ee9d22ad1e6a3a5 Author: Martin Liska <mliska@suse.cz> Date: Mon Nov 8 15:57:05 2021 +0100 Use global ranger. Diff: --- gcc/tree-ssa-loop-unswitch.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c index 4b4bd471acd..41261efe404 100644 --- a/gcc/tree-ssa-loop-unswitch.c +++ b/gcc/tree-ssa-loop-unswitch.c @@ -79,7 +79,7 @@ along with GCC; see the file COPYING3. If not see shape. */ static class loop *tree_unswitch_loop (class loop *, basic_block, tree, edge); -static bool tree_unswitch_single_loop (class loop *, int); +static bool tree_unswitch_single_loop (class loop *, gimple_ranger *ranger, int); static tree tree_may_unswitch_on (basic_block, class loop *, edge *); static bool tree_unswitch_outer_loop (class loop *); static edge find_loop_guard (class loop *); @@ -96,16 +96,18 @@ unsigned int tree_ssa_unswitch_loops (void) { bool changed = false; + gimple_ranger *ranger = enable_ranger (cfun); /* Go through all loops starting from innermost. */ for (auto loop : loops_list (cfun, LI_FROM_INNERMOST)) { if (!loop->inner) /* Unswitch innermost loop. */ - changed |= tree_unswitch_single_loop (loop, 0); + changed |= tree_unswitch_single_loop (loop, ranger, 0); else changed |= tree_unswitch_outer_loop (loop); } + disable_ranger (cfun); if (changed) { @@ -305,7 +307,7 @@ tree_may_unswitch_on (basic_block bb, class loop *loop, edge *cond_edge) grow exponentially. */ static bool -tree_unswitch_single_loop (class loop *loop, int num) +tree_unswitch_single_loop (class loop *loop, gimple_ranger *ranger, int num) { basic_block *bbs; class loop *nloop; @@ -354,7 +356,6 @@ tree_unswitch_single_loop (class loop *loop, int num) bbs = get_loop_body (loop); found = loop->num_nodes; - gimple_ranger ranger; while (1) { /* Find a bb to unswitch on. */ @@ -386,7 +387,7 @@ tree_unswitch_single_loop (class loop *loop, int num) tree result; int_range_max r; - if (ranger.range_of_stmt (r, stmt) && r.singleton_p (&result)) + if (ranger->range_of_stmt (r, stmt) && r.singleton_p (&result)) { gimple_cond_set_condition_from_tree (condition, result); @@ -407,7 +408,7 @@ tree_unswitch_single_loop (class loop *loop, int num) edge e = find_edge (gimple_bb (stmt), dest); int_range_max r; - if (ranger.range_on_edge (r, e, gimple_switch_index (swtch)) + if (ranger->range_on_edge (r, e, gimple_switch_index (swtch)) && r.undefined_p ()) { e->flags |= EDGE_IGNORE; @@ -542,8 +543,8 @@ tree_unswitch_single_loop (class loop *loop, int num) free_original_copy_tables (); /* Invoke itself on modified loops. */ - tree_unswitch_single_loop (nloop, num + 1); - tree_unswitch_single_loop (loop, num + 1); + tree_unswitch_single_loop (nloop, ranger, num + 1); + tree_unswitch_single_loop (loop, ranger, num + 1); free (bbs); return true; }
next reply other threads:[~2021-11-08 15:30 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-11-08 15:30 Martin Liska [this message] 2021-11-08 15:36 Martin Liska
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=20211108153044.B2825385842E@sourceware.org \ --to=marxin@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).