public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/loop-unswitch-improvement)] Simplify early exit.
@ 2021-11-19 13:53 Martin Liska
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Liska @ 2021-11-19 13:53 UTC (permalink / raw)
  To: gcc-cvs

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

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

    Simplify early exit.

Diff:
---
 gcc/tree-ssa-loop-unswitch.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index e465e14a6ab..fb5bcf5a13d 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -366,10 +366,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 	    fprintf (dump_file, ";; Not unswitching anymore, hit max level\n");
 
 	  if (found == loop->num_nodes)
-	    {
-	      free (bbs);
-	      return changed;
-	    }
+	    goto exit;
 	  break;
 	}
 
@@ -382,6 +379,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 	  gimple_cond_set_condition_from_tree (as_a <gcond *> (stmt),
 					       boolean_true_node);
 	  delete predicate;
+	  predicate = NULL;
 	  changed = true;
 	}
       else if (folded != NULL_TREE && integer_zerop (folded))
@@ -390,6 +388,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 	  gimple_cond_set_condition_from_tree (as_a <gcond *> (stmt),
 					       boolean_false_node);
 	  delete predicate;
+	  predicate = NULL;
 	  changed = true;
 	}
       /* Do not unswitch too much.  */
@@ -477,11 +476,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 	  break;
 
       if (found == loop->num_nodes)
-	{
-	  free (bbs);
-	  delete predicate;
-	  return changed;
-	}
+	goto exit;
     }
 
   if (dump_file && (dump_flags & TDF_DETAILS))
@@ -497,9 +492,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
   if (!nloop)
     {
       free_original_copy_tables ();
-      delete predicate;
-      free (bbs);
-      return changed;
+      goto exit;
     }
 
   /* Update the SSA form after unswitching.  */
@@ -512,6 +505,11 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
   delete predicate;
   free (bbs);
   return true;
+
+exit:
+  free (bbs);
+  delete predicate;
+  return changed;
 }
 
 /* Unswitch a LOOP w.r. to given basic block UNSWITCH_ON.  We only support


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

* [gcc(refs/users/marxin/heads/loop-unswitch-improvement)] Simplify early exit.
@ 2021-11-22 12:44 Martin Liska
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Liska @ 2021-11-22 12:44 UTC (permalink / raw)
  To: gcc-cvs

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

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

    Simplify early exit.

Diff:
---
 gcc/tree-ssa-loop-unswitch.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index e465e14a6ab..fb5bcf5a13d 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -366,10 +366,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 	    fprintf (dump_file, ";; Not unswitching anymore, hit max level\n");
 
 	  if (found == loop->num_nodes)
-	    {
-	      free (bbs);
-	      return changed;
-	    }
+	    goto exit;
 	  break;
 	}
 
@@ -382,6 +379,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 	  gimple_cond_set_condition_from_tree (as_a <gcond *> (stmt),
 					       boolean_true_node);
 	  delete predicate;
+	  predicate = NULL;
 	  changed = true;
 	}
       else if (folded != NULL_TREE && integer_zerop (folded))
@@ -390,6 +388,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 	  gimple_cond_set_condition_from_tree (as_a <gcond *> (stmt),
 					       boolean_false_node);
 	  delete predicate;
+	  predicate = NULL;
 	  changed = true;
 	}
       /* Do not unswitch too much.  */
@@ -477,11 +476,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 	  break;
 
       if (found == loop->num_nodes)
-	{
-	  free (bbs);
-	  delete predicate;
-	  return changed;
-	}
+	goto exit;
     }
 
   if (dump_file && (dump_flags & TDF_DETAILS))
@@ -497,9 +492,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
   if (!nloop)
     {
       free_original_copy_tables ();
-      delete predicate;
-      free (bbs);
-      return changed;
+      goto exit;
     }
 
   /* Update the SSA form after unswitching.  */
@@ -512,6 +505,11 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
   delete predicate;
   free (bbs);
   return true;
+
+exit:
+  free (bbs);
+  delete predicate;
+  return changed;
 }
 
 /* Unswitch a LOOP w.r. to given basic block UNSWITCH_ON.  We only support


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

* [gcc(refs/users/marxin/heads/loop-unswitch-improvement)] Simplify early exit.
@ 2021-11-19 14:34 Martin Liska
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Liska @ 2021-11-19 14:34 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:65be33a9c98bef02d2932c0341f405d5debd34ee

commit 65be33a9c98bef02d2932c0341f405d5debd34ee
Author: Martin Liska <mliska@suse.cz>
Date:   Tue Nov 16 10:45:16 2021 +0100

    Simplify early exit.

Diff:
---
 gcc/tree-ssa-loop-unswitch.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index e465e14a6ab..fb5bcf5a13d 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -366,10 +366,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 	    fprintf (dump_file, ";; Not unswitching anymore, hit max level\n");
 
 	  if (found == loop->num_nodes)
-	    {
-	      free (bbs);
-	      return changed;
-	    }
+	    goto exit;
 	  break;
 	}
 
@@ -382,6 +379,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 	  gimple_cond_set_condition_from_tree (as_a <gcond *> (stmt),
 					       boolean_true_node);
 	  delete predicate;
+	  predicate = NULL;
 	  changed = true;
 	}
       else if (folded != NULL_TREE && integer_zerop (folded))
@@ -390,6 +388,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 	  gimple_cond_set_condition_from_tree (as_a <gcond *> (stmt),
 					       boolean_false_node);
 	  delete predicate;
+	  predicate = NULL;
 	  changed = true;
 	}
       /* Do not unswitch too much.  */
@@ -477,11 +476,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 	  break;
 
       if (found == loop->num_nodes)
-	{
-	  free (bbs);
-	  delete predicate;
-	  return changed;
-	}
+	goto exit;
     }
 
   if (dump_file && (dump_flags & TDF_DETAILS))
@@ -497,9 +492,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
   if (!nloop)
     {
       free_original_copy_tables ();
-      delete predicate;
-      free (bbs);
-      return changed;
+      goto exit;
     }
 
   /* Update the SSA form after unswitching.  */
@@ -512,6 +505,11 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
   delete predicate;
   free (bbs);
   return true;
+
+exit:
+  free (bbs);
+  delete predicate;
+  return changed;
 }
 
 /* Unswitch a LOOP w.r. to given basic block UNSWITCH_ON.  We only support


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

* [gcc(refs/users/marxin/heads/loop-unswitch-improvement)] Simplify early exit.
@ 2021-11-16  9:46 Martin Liska
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Liska @ 2021-11-16  9:46 UTC (permalink / raw)
  To: gcc-cvs

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

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

    Simplify early exit.

Diff:
---
 gcc/tree-ssa-loop-unswitch.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index e465e14a6ab..fb5bcf5a13d 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -366,10 +366,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 	    fprintf (dump_file, ";; Not unswitching anymore, hit max level\n");
 
 	  if (found == loop->num_nodes)
-	    {
-	      free (bbs);
-	      return changed;
-	    }
+	    goto exit;
 	  break;
 	}
 
@@ -382,6 +379,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 	  gimple_cond_set_condition_from_tree (as_a <gcond *> (stmt),
 					       boolean_true_node);
 	  delete predicate;
+	  predicate = NULL;
 	  changed = true;
 	}
       else if (folded != NULL_TREE && integer_zerop (folded))
@@ -390,6 +388,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 	  gimple_cond_set_condition_from_tree (as_a <gcond *> (stmt),
 					       boolean_false_node);
 	  delete predicate;
+	  predicate = NULL;
 	  changed = true;
 	}
       /* Do not unswitch too much.  */
@@ -477,11 +476,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
 	  break;
 
       if (found == loop->num_nodes)
-	{
-	  free (bbs);
-	  delete predicate;
-	  return changed;
-	}
+	goto exit;
     }
 
   if (dump_file && (dump_flags & TDF_DETAILS))
@@ -497,9 +492,7 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
   if (!nloop)
     {
       free_original_copy_tables ();
-      delete predicate;
-      free (bbs);
-      return changed;
+      goto exit;
     }
 
   /* Update the SSA form after unswitching.  */
@@ -512,6 +505,11 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger,
   delete predicate;
   free (bbs);
   return true;
+
+exit:
+  free (bbs);
+  delete predicate;
+  return changed;
 }
 
 /* Unswitch a LOOP w.r. to given basic block UNSWITCH_ON.  We only support


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

end of thread, other threads:[~2021-11-22 12:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-19 13:53 [gcc(refs/users/marxin/heads/loop-unswitch-improvement)] Simplify early exit Martin Liska
  -- strict thread matches above, loose matches on Subject: below --
2021-11-22 12:44 Martin Liska
2021-11-19 14:34 Martin Liska
2021-11-16  9:46 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).