public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/loop-unswitch-improvement-v3)] Add comments, fix various tweaks.
@ 2021-11-29 11:13 Martin Liska
  0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2021-11-29 11:13 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:5b3da0045f3f572ec55ab7c48ec95d3753c4fe02

commit 5b3da0045f3f572ec55ab7c48ec95d3753c4fe02
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Nov 29 11:55:43 2021 +0100

    Add comments, fix various tweaks.

Diff:
---
 gcc/tree-ssa-loop-unswitch.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 1d5bcfc3237..a41c25784f3 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -95,10 +95,13 @@ struct unswitch_predicate
   int_range_max false_range;
 };
 
+/* Cache storage for unswitch_predicate belonging to a basic block.  */
 static vec<vec<unswitch_predicate *>> *bb_predicates = NULL;
 
+/* Ranger instance used in the pass.  */
 static gimple_ranger *ranger = NULL;
 
+/* The type represents a predicate path leading to a basic block.  */
 typedef auto_vec<std::pair<unswitch_predicate *, bool>> predicate_vector;
 
 static class loop *tree_unswitch_loop (class loop *, basic_block, tree);
@@ -115,6 +118,8 @@ static void hoist_guard (class loop *, edge);
 static bool check_exit_phi (class loop *);
 static tree get_vop_from_header (class loop *);
 
+/* Return vector of predicates that belong to a basic block.  */
+
 static vec<unswitch_predicate *> &
 get_predicates_for_bb (basic_block bb)
 {
@@ -122,6 +127,8 @@ get_predicates_for_bb (basic_block bb)
   return (*bb_predicates)[last == NULL ? 0 : gimple_uid (last)];
 }
 
+/* Save predicates that belong to a basic block.  */
+
 static void
 set_predicates_for_bb (basic_block bb, vec<unswitch_predicate *> predicates)
 {
@@ -129,6 +136,8 @@ set_predicates_for_bb (basic_block bb, vec<unswitch_predicate *> predicates)
   bb_predicates->safe_push (predicates);
 }
 
+/* Initialize LOOP information reused during the unswitching pass.  */
+
 static void
 init_loop_unswitch_info (class loop *loop)
 {
@@ -193,7 +202,9 @@ tree_ssa_unswitch_loops (void)
 	changed |= tree_unswitch_outer_loop (loop);
     }
 
+
   disable_ranger (cfun);
+  clear_aux_for_blocks ();
 
   if (changed)
     return TODO_cleanup_cfg;
@@ -366,7 +377,8 @@ combine_range (predicate_vector &predicate_path, tree index, irange &path_range)
    Utilize both symbolic expressions and value ranges calculated by Ranger.  */
 
 static tree
-simplify_using_entry_checks (gimple *stmt, predicate_vector &predicate_path)
+evaluate_control_stmt_using_entry_checks (gimple *stmt,
+					  predicate_vector &predicate_path)
 {
   if (predicate_path.is_empty ())
     return NULL_TREE;
@@ -415,7 +427,8 @@ simplify_loop_version (class loop *loop, predicate_vector &predicate_path)
 	{
 	  gimple *stmt = last_stmt (bbs[i]);
 
-	  tree folded = simplify_using_entry_checks (stmt, predicate_path);
+	  tree folded = evaluate_control_stmt_using_entry_checks (stmt,
+								  predicate_path);
 	  if (folded != NULL_TREE)
 	    {
 	      /* Remove path.  */
@@ -475,7 +488,8 @@ evaluate_insns (class loop *loop,  basic_block *bbs,
 		  if (predicate != NULL)
 		    {
 		      tree folded
-			= simplify_using_entry_checks (cond, predicate_path);
+			= evaluate_control_stmt_using_entry_checks (cond,
+								    predicate_path);
 		      if (folded == boolean_true_node)
 			flags = EDGE_FALSE_VALUE;
 		      else if (folded == boolean_false_node)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-29 11:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-29 11:13 [gcc(refs/users/marxin/heads/loop-unswitch-improvement-v3)] Add comments, fix various tweaks 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).