From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id 9AF053858D35; Mon, 22 Nov 2021 12:52:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9AF053858D35 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)] Add comments. X-Act-Checkin: gcc X-Git-Author: Martin Liska X-Git-Refname: refs/users/marxin/heads/loop-unswitch-improvement X-Git-Oldrev: 6057f4886c607528ebf2153ad74d9b3f2f10259a X-Git-Newrev: d66bcc2c1104bb6577adfe97bf1fb41d91de9809 Message-Id: <20211122125246.9AF053858D35@sourceware.org> Date: Mon, 22 Nov 2021 12:52:46 +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, 22 Nov 2021 12:52:46 -0000 https://gcc.gnu.org/g:d66bcc2c1104bb6577adfe97bf1fb41d91de9809 commit d66bcc2c1104bb6577adfe97bf1fb41d91de9809 Author: Martin Liska Date: Mon Nov 22 13:50:22 2021 +0100 Add comments. Diff: --- gcc/tree-ssa-loop-unswitch.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c index 92b94e581ff..ae2b5e1239a 100644 --- a/gcc/tree-ssa-loop-unswitch.c +++ b/gcc/tree-ssa-loop-unswitch.c @@ -303,7 +303,10 @@ simplify_using_entry_checks (unswitch_predicate *predicate, return NULL_TREE; } -/* Find all unswitching predicates. */ +/* Find all unswitching predicates for a LOOP that contains BBS. + TRUE_EDGE distinguish which PARENT_PREDICATE should be used when + asking RANGER infrastructure. Return unswitch_predicate in the provided + CANDIDATES vector. */ static bool find_all_unswitching_predicates (class loop *loop, basic_block *bbs, @@ -346,6 +349,11 @@ find_all_unswitching_predicates (class loop *loop, basic_block *bbs, return changed; } +/* Evaluate how many instructions will be executed if we unswitch + LOOP (with BBS) based on PREDICATE. TRUE_EDGE distinguishes if + we calculate taken or not taken edge when asking RANGER. + REACHABLE_FLAG is used for marking of the basic blocks. */ + static unsigned evaluate_insns (class loop *loop, basic_block *bbs, unswitch_predicate *candidate, bool true_edge, @@ -420,17 +428,20 @@ evaluate_insns (class loop *loop, basic_block *bbs, return size; } +/* Evaluate how many instruction will we have if we unswitch LOOP (with BBS) + based on CANDIDATE predicate (using RANGER infrastructure). */ + static unsigned evaluate_loop_insns_for_predicate (class loop *loop, basic_block *bbs, gimple_ranger *ranger, unswitch_predicate *candidate) { - auto_bb_flag reachable_true (cfun), reachable_false (cfun); + auto_bb_flag reachable_flag (cfun); unsigned true_loop_cost = evaluate_insns (loop, bbs, candidate, true, - ranger, reachable_true); + ranger, reachable_flag); unsigned false_loop_cost = evaluate_insns (loop, bbs, candidate, false, - ranger, reachable_false); + ranger, reachable_flag); return true_loop_cost + false_loop_cost; }