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-unswitch-improvement)] Add comments.
Date: Mon, 22 Nov 2021 12:52:46 +0000 (GMT)	[thread overview]
Message-ID: <20211122125246.9AF053858D35@sourceware.org> (raw)

https://gcc.gnu.org/g:d66bcc2c1104bb6577adfe97bf1fb41d91de9809

commit d66bcc2c1104bb6577adfe97bf1fb41d91de9809
Author: Martin Liska <mliska@suse.cz>
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;
 }


                 reply	other threads:[~2021-11-22 12:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20211122125246.9AF053858D35@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: link
Be 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).