From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id 0CB263858029; Mon, 8 Nov 2021 15:36:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0CB263858029 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)] Revert "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: 3a37d892d5e09ad2dc17b4dbc5281c7fd5156dd2 X-Git-Newrev: 7f763ce3358aa3e9782515d67ca8b8ef05969422 Message-Id: <20211108153639.0CB263858029@sourceware.org> Date: Mon, 8 Nov 2021 15:36:39 +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:36:39 -0000 https://gcc.gnu.org/g:7f763ce3358aa3e9782515d67ca8b8ef05969422 commit 7f763ce3358aa3e9782515d67ca8b8ef05969422 Author: Martin Liska Date: Mon Nov 8 16:18:22 2021 +0100 Revert "Use global ranger." This reverts commit 5df2804ff8197cfd7d45a9e28ee9d22ad1e6a3a5. Diff: --- gcc/tree-ssa-loop-unswitch.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c index 41261efe404..4b4bd471acd 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 *, gimple_ranger *ranger, int); +static bool tree_unswitch_single_loop (class loop *, 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,18 +96,16 @@ 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, ranger, 0); + changed |= tree_unswitch_single_loop (loop, 0); else changed |= tree_unswitch_outer_loop (loop); } - disable_ranger (cfun); if (changed) { @@ -307,7 +305,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, gimple_ranger *ranger, int num) +tree_unswitch_single_loop (class loop *loop, int num) { basic_block *bbs; class loop *nloop; @@ -356,6 +354,7 @@ tree_unswitch_single_loop (class loop *loop, gimple_ranger *ranger, int num) bbs = get_loop_body (loop); found = loop->num_nodes; + gimple_ranger ranger; while (1) { /* Find a bb to unswitch on. */ @@ -387,7 +386,7 @@ tree_unswitch_single_loop (class loop *loop, gimple_ranger *ranger, 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); @@ -408,7 +407,7 @@ tree_unswitch_single_loop (class loop *loop, gimple_ranger *ranger, 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; @@ -543,8 +542,8 @@ tree_unswitch_single_loop (class loop *loop, gimple_ranger *ranger, int num) free_original_copy_tables (); /* Invoke itself on modified loops. */ - tree_unswitch_single_loop (nloop, ranger, num + 1); - tree_unswitch_single_loop (loop, ranger, num + 1); + tree_unswitch_single_loop (nloop, num + 1); + tree_unswitch_single_loop (loop, num + 1); free (bbs); return true; }