public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/loop-unswitch-improvement)] Add comments.
@ 2021-11-22 12:52 Martin Liska
0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2021-11-22 12:52 UTC (permalink / raw)
To: gcc-cvs
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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-11-22 12:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-22 12:52 [gcc(refs/users/marxin/heads/loop-unswitch-improvement)] Add comments Martin Liska
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).