From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id AC745385781B; Fri, 19 Nov 2021 13:53:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AC745385781B 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-unswitch-improvement)] Simplify early exit. X-Act-Checkin: gcc X-Git-Author: Martin Liska X-Git-Refname: refs/users/marxin/heads/loop-unswitch-improvement X-Git-Oldrev: fe39426dd45d591a9337abf36eeb7b3053fcd758 X-Git-Newrev: cf54deff893c856109e3604797a554ad78f5206b Message-Id: <20211119135339.AC745385781B@sourceware.org> Date: Fri, 19 Nov 2021 13:53: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: Fri, 19 Nov 2021 13:53:39 -0000 https://gcc.gnu.org/g:cf54deff893c856109e3604797a554ad78f5206b commit cf54deff893c856109e3604797a554ad78f5206b Author: Martin Liska Date: Tue Nov 16 10:45:16 2021 +0100 Simplify early exit. Diff: --- gcc/tree-ssa-loop-unswitch.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c index e465e14a6ab..fb5bcf5a13d 100644 --- a/gcc/tree-ssa-loop-unswitch.c +++ b/gcc/tree-ssa-loop-unswitch.c @@ -366,10 +366,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger, fprintf (dump_file, ";; Not unswitching anymore, hit max level\n"); if (found == loop->num_nodes) - { - free (bbs); - return changed; - } + goto exit; break; } @@ -382,6 +379,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger, gimple_cond_set_condition_from_tree (as_a (stmt), boolean_true_node); delete predicate; + predicate = NULL; changed = true; } else if (folded != NULL_TREE && integer_zerop (folded)) @@ -390,6 +388,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger, gimple_cond_set_condition_from_tree (as_a (stmt), boolean_false_node); delete predicate; + predicate = NULL; changed = true; } /* Do not unswitch too much. */ @@ -477,11 +476,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger, break; if (found == loop->num_nodes) - { - free (bbs); - delete predicate; - return changed; - } + goto exit; } if (dump_file && (dump_flags & TDF_DETAILS)) @@ -497,9 +492,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger, if (!nloop) { free_original_copy_tables (); - delete predicate; - free (bbs); - return changed; + goto exit; } /* Update the SSA form after unswitching. */ @@ -512,6 +505,11 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger, delete predicate; free (bbs); return true; + +exit: + free (bbs); + delete predicate; + return changed; } /* Unswitch a LOOP w.r. to given basic block UNSWITCH_ON. We only support