From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id B2825385842E; Mon, 8 Nov 2021 15:30:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B2825385842E Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Martin Liska To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/marxin/heads/loop-unswitching-switch-v5)] Use global ranger. X-Act-Checkin: gcc X-Git-Author: Martin Liska X-Git-Refname: refs/users/marxin/heads/loop-unswitching-switch-v5 X-Git-Oldrev: 0534ab9eebb1900fc172e014a515c94119c411ac X-Git-Newrev: 5df2804ff8197cfd7d45a9e28ee9d22ad1e6a3a5 Message-Id: <20211108153044.B2825385842E@sourceware.org> Date: Mon, 8 Nov 2021 15:30:44 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2021 15:30:44 -0000 https://gcc.gnu.org/g:5df2804ff8197cfd7d45a9e28ee9d22ad1e6a3a5 commit 5df2804ff8197cfd7d45a9e28ee9d22ad1e6a3a5 Author: Martin Liska 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; }