public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/loop-unswitch-improvement-v3)] small tweaks.
@ 2021-11-24 14:04 Martin Liska
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Liska @ 2021-11-24 14:04 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:53e6e076153656104527f7aeba94b7fb1b4cbdd2

commit 53e6e076153656104527f7aeba94b7fb1b4cbdd2
Author: Martin Liska <mliska@suse.cz>
Date:   Tue Nov 23 16:30:45 2021 +0100

    small tweaks.

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

diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 6895e5b8bb9..57ddd769b31 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -455,7 +455,7 @@ static bool
 tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 			   unswitch_predicate *parent_predicate, bool true_edge)
 {
-  basic_block *bbs;
+  basic_block *bbs = NULL;
   class loop *nloop;
   bool changed = false;
   HOST_WIDE_INT iterations;
@@ -485,14 +485,9 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 	}
     }
 
-  bbs = get_loop_body (loop);
   auto_vec<unswitch_predicate *> candidates;
-
-  changed = find_all_unswitching_predicates (loop, bbs, true_edge,
-					     parent_predicate, ranger,
-					     candidates);
-
   unswitch_predicate *predicate = NULL;
+
   if (num > param_max_unswitch_level)
     {
       if (dump_file
@@ -501,11 +496,18 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
       goto exit;
     }
 
+  bbs = get_loop_body (loop);
+  changed = find_all_unswitching_predicates (loop, bbs, true_edge,
+					     parent_predicate, ranger,
+					     candidates);
+
   for (auto pred: candidates)
     {
       unsigned cost
 	= evaluate_loop_insns_for_predicate (loop, bbs, ranger, pred);
 
+      /* FIXME: right now we select first candidate, but we can choose
+	 a cheapest (best) one.  */
       if (cost <= (unsigned)param_max_unswitch_insns)
 	{
 	  predicate = pred;
@@ -513,7 +515,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 	}
       else if (dump_file && (dump_flags & TDF_DETAILS))
 	{
-	  fprintf (dump_file, ";; Not unswitching condition, loop too big "
+	  fprintf (dump_file, ";; Not unswitching condition, cost too big "
 		   "(%d insns): ", cost);
 	  print_generic_expr (dump_file, pred->condition);
 	  fprintf (dump_file, "\n");
@@ -527,7 +529,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 
       if (dump_file && (dump_flags & TDF_DETAILS))
 	{
-	  fprintf (dump_file, ";; Unswitching loop with condition: ");
+	  fprintf (dump_file, ";; Unswitching loop on condition: ");
 	  print_generic_expr (dump_file, predicate->condition);
 	  fprintf (dump_file, "\n");
 	}


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [gcc(refs/users/marxin/heads/loop-unswitch-improvement-v3)] small tweaks.
@ 2021-11-29 11:13 Martin Liska
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Liska @ 2021-11-29 11:13 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:9fdb39c9393bd5b705d73ceedb9b1ce6543eaeed

commit 9fdb39c9393bd5b705d73ceedb9b1ce6543eaeed
Author: Martin Liska <mliska@suse.cz>
Date:   Tue Nov 23 16:30:45 2021 +0100

    small tweaks.

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

diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 6895e5b8bb9..57ddd769b31 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -455,7 +455,7 @@ static bool
 tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 			   unswitch_predicate *parent_predicate, bool true_edge)
 {
-  basic_block *bbs;
+  basic_block *bbs = NULL;
   class loop *nloop;
   bool changed = false;
   HOST_WIDE_INT iterations;
@@ -485,14 +485,9 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 	}
     }
 
-  bbs = get_loop_body (loop);
   auto_vec<unswitch_predicate *> candidates;
-
-  changed = find_all_unswitching_predicates (loop, bbs, true_edge,
-					     parent_predicate, ranger,
-					     candidates);
-
   unswitch_predicate *predicate = NULL;
+
   if (num > param_max_unswitch_level)
     {
       if (dump_file
@@ -501,11 +496,18 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
       goto exit;
     }
 
+  bbs = get_loop_body (loop);
+  changed = find_all_unswitching_predicates (loop, bbs, true_edge,
+					     parent_predicate, ranger,
+					     candidates);
+
   for (auto pred: candidates)
     {
       unsigned cost
 	= evaluate_loop_insns_for_predicate (loop, bbs, ranger, pred);
 
+      /* FIXME: right now we select first candidate, but we can choose
+	 a cheapest (best) one.  */
       if (cost <= (unsigned)param_max_unswitch_insns)
 	{
 	  predicate = pred;
@@ -513,7 +515,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 	}
       else if (dump_file && (dump_flags & TDF_DETAILS))
 	{
-	  fprintf (dump_file, ";; Not unswitching condition, loop too big "
+	  fprintf (dump_file, ";; Not unswitching condition, cost too big "
 		   "(%d insns): ", cost);
 	  print_generic_expr (dump_file, pred->condition);
 	  fprintf (dump_file, "\n");
@@ -527,7 +529,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 
       if (dump_file && (dump_flags & TDF_DETAILS))
 	{
-	  fprintf (dump_file, ";; Unswitching loop with condition: ");
+	  fprintf (dump_file, ";; Unswitching loop on condition: ");
 	  print_generic_expr (dump_file, predicate->condition);
 	  fprintf (dump_file, "\n");
 	}


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [gcc(refs/users/marxin/heads/loop-unswitch-improvement-v3)] small tweaks.
@ 2021-11-24 14:33 Martin Liska
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Liska @ 2021-11-24 14:33 UTC (permalink / raw)
  To: gcc-cvs

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

commit d1c5ce63cd41244bcc0c96f664952ff46e5388e0
Author: Martin Liska <mliska@suse.cz>
Date:   Tue Nov 23 16:30:45 2021 +0100

    small tweaks.

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

diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 6895e5b8bb9..57ddd769b31 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -455,7 +455,7 @@ static bool
 tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 			   unswitch_predicate *parent_predicate, bool true_edge)
 {
-  basic_block *bbs;
+  basic_block *bbs = NULL;
   class loop *nloop;
   bool changed = false;
   HOST_WIDE_INT iterations;
@@ -485,14 +485,9 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 	}
     }
 
-  bbs = get_loop_body (loop);
   auto_vec<unswitch_predicate *> candidates;
-
-  changed = find_all_unswitching_predicates (loop, bbs, true_edge,
-					     parent_predicate, ranger,
-					     candidates);
-
   unswitch_predicate *predicate = NULL;
+
   if (num > param_max_unswitch_level)
     {
       if (dump_file
@@ -501,11 +496,18 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
       goto exit;
     }
 
+  bbs = get_loop_body (loop);
+  changed = find_all_unswitching_predicates (loop, bbs, true_edge,
+					     parent_predicate, ranger,
+					     candidates);
+
   for (auto pred: candidates)
     {
       unsigned cost
 	= evaluate_loop_insns_for_predicate (loop, bbs, ranger, pred);
 
+      /* FIXME: right now we select first candidate, but we can choose
+	 a cheapest (best) one.  */
       if (cost <= (unsigned)param_max_unswitch_insns)
 	{
 	  predicate = pred;
@@ -513,7 +515,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 	}
       else if (dump_file && (dump_flags & TDF_DETAILS))
 	{
-	  fprintf (dump_file, ";; Not unswitching condition, loop too big "
+	  fprintf (dump_file, ";; Not unswitching condition, cost too big "
 		   "(%d insns): ", cost);
 	  print_generic_expr (dump_file, pred->condition);
 	  fprintf (dump_file, "\n");
@@ -527,7 +529,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 
       if (dump_file && (dump_flags & TDF_DETAILS))
 	{
-	  fprintf (dump_file, ";; Unswitching loop with condition: ");
+	  fprintf (dump_file, ";; Unswitching loop on condition: ");
 	  print_generic_expr (dump_file, predicate->condition);
 	  fprintf (dump_file, "\n");
 	}


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-29 11:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-24 14:04 [gcc(refs/users/marxin/heads/loop-unswitch-improvement-v3)] small tweaks Martin Liska
2021-11-24 14:33 Martin Liska
2021-11-29 11:13 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).