public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/loop-unswitch-improvement-v7)] Simplify a bit.
@ 2021-12-08 10:17 Martin Liska
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Liska @ 2021-12-08 10:17 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:302ecbf8a4f413d305d097569c902ecf19630d81

commit 302ecbf8a4f413d305d097569c902ecf19630d81
Author: Martin Liska <mliska@suse.cz>
Date:   Tue Nov 30 17:30:16 2021 +0100

    Simplify a bit.

Diff:
---
 gcc/tree-ssa-loop-unswitch.c | 46 ++++++++++++++++++++------------------------
 1 file changed, 21 insertions(+), 25 deletions(-)

diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 4bb108adc7c..7b5bd8afec7 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -41,8 +41,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "gimple-range.h"
 #include "dbgcnt.h"
 
-#include <utility>
-
 /* This file implements the loop unswitching, i.e. transformation of loops like
 
    while (A)
@@ -474,32 +472,30 @@ evaluate_insns (class loop *loop, basic_block *bbs,
       int flags = 0;
       basic_block bb = worklist.pop ();
 
-      if (EDGE_COUNT (bb->succs) == 2)
+      gimple *last = last_stmt (bb);
+      gcond *cond = last != NULL ? dyn_cast<gcond *> (last) : NULL;
+      if (cond != NULL)
 	{
-	  gcond *cond = dyn_cast<gcond *> (last_stmt (bb));
-	  if (cond != NULL)
+	  if (gimple_cond_true_p (cond))
+	    flags = EDGE_FALSE_VALUE;
+	  else if (gimple_cond_false_p (cond))
+	    flags = EDGE_TRUE_VALUE;
+	  else
 	    {
-	      if (gimple_cond_true_p (cond))
-		flags = EDGE_FALSE_VALUE;
-	      else if (gimple_cond_false_p (cond))
-		flags = EDGE_TRUE_VALUE;
-	      else
+	      // FIXME: works only for gconds
+	      unswitch_predicate *predicate = NULL;
+	      if (!get_predicates_for_bb (bb).is_empty ())
+		predicate = get_predicates_for_bb (bb)[0];
+
+	      if (predicate != NULL)
 		{
-		  // FIXME: works only for gconds
-		  unswitch_predicate *predicate = NULL;
-		  if (!get_predicates_for_bb (bb).is_empty ())
-		    predicate = get_predicates_for_bb (bb)[0];
-
-		  if (predicate != NULL)
-		    {
-		      tree folded
-			= evaluate_control_stmt_using_entry_checks (cond,
-								    predicate_path);
-		      if (folded == boolean_true_node)
-			flags = EDGE_FALSE_VALUE;
-		      else if (folded == boolean_false_node)
-			flags = EDGE_TRUE_VALUE;
-		    }
+		  tree folded
+		    = evaluate_control_stmt_using_entry_checks (cond,
+								predicate_path);
+		  if (folded == boolean_true_node)
+		    flags = EDGE_FALSE_VALUE;
+		  else if (folded == boolean_false_node)
+		    flags = EDGE_TRUE_VALUE;
 		}
 	    }
 	}


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

* [gcc(refs/users/marxin/heads/loop-unswitch-improvement-v7)] Simplify a bit.
@ 2021-12-09 12:47 Martin Liska
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Liska @ 2021-12-09 12:47 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:26a704a8081e834c2ce67142df3aece8e65c78af

commit 26a704a8081e834c2ce67142df3aece8e65c78af
Author: Martin Liska <mliska@suse.cz>
Date:   Tue Nov 30 17:30:16 2021 +0100

    Simplify a bit.

Diff:
---
 gcc/tree-ssa-loop-unswitch.c | 46 ++++++++++++++++++++------------------------
 1 file changed, 21 insertions(+), 25 deletions(-)

diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 10804cf4b1e..bd71e9d9fbd 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -42,8 +42,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "gimple-range.h"
 #include "dbgcnt.h"
 
-#include <utility>
-
 /* This file implements the loop unswitching, i.e. transformation of loops like
 
    while (A)
@@ -475,32 +473,30 @@ evaluate_insns (class loop *loop, basic_block *bbs,
       int flags = 0;
       basic_block bb = worklist.pop ();
 
-      if (EDGE_COUNT (bb->succs) == 2)
+      gimple *last = last_stmt (bb);
+      gcond *cond = last != NULL ? dyn_cast<gcond *> (last) : NULL;
+      if (cond != NULL)
 	{
-	  gcond *cond = dyn_cast<gcond *> (last_stmt (bb));
-	  if (cond != NULL)
+	  if (gimple_cond_true_p (cond))
+	    flags = EDGE_FALSE_VALUE;
+	  else if (gimple_cond_false_p (cond))
+	    flags = EDGE_TRUE_VALUE;
+	  else
 	    {
-	      if (gimple_cond_true_p (cond))
-		flags = EDGE_FALSE_VALUE;
-	      else if (gimple_cond_false_p (cond))
-		flags = EDGE_TRUE_VALUE;
-	      else
+	      // FIXME: works only for gconds
+	      unswitch_predicate *predicate = NULL;
+	      if (!get_predicates_for_bb (bb).is_empty ())
+		predicate = get_predicates_for_bb (bb)[0];
+
+	      if (predicate != NULL)
 		{
-		  // FIXME: works only for gconds
-		  unswitch_predicate *predicate = NULL;
-		  if (!get_predicates_for_bb (bb).is_empty ())
-		    predicate = get_predicates_for_bb (bb)[0];
-
-		  if (predicate != NULL)
-		    {
-		      tree folded
-			= evaluate_control_stmt_using_entry_checks (cond,
-								    predicate_path);
-		      if (folded == boolean_true_node)
-			flags = EDGE_FALSE_VALUE;
-		      else if (folded == boolean_false_node)
-			flags = EDGE_TRUE_VALUE;
-		    }
+		  tree folded
+		    = evaluate_control_stmt_using_entry_checks (cond,
+								predicate_path);
+		  if (folded == boolean_true_node)
+		    flags = EDGE_FALSE_VALUE;
+		  else if (folded == boolean_false_node)
+		    flags = EDGE_TRUE_VALUE;
 		}
 	    }
 	}


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

* [gcc(refs/users/marxin/heads/loop-unswitch-improvement-v7)] Simplify a bit.
@ 2021-12-08 18:25 Martin Liska
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Liska @ 2021-12-08 18:25 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0dcb29168804c2e4f7162b4c623574e89bcee770

commit 0dcb29168804c2e4f7162b4c623574e89bcee770
Author: Martin Liska <mliska@suse.cz>
Date:   Tue Nov 30 17:30:16 2021 +0100

    Simplify a bit.

Diff:
---
 gcc/tree-ssa-loop-unswitch.c | 46 ++++++++++++++++++++------------------------
 1 file changed, 21 insertions(+), 25 deletions(-)

diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 10804cf4b1e..bd71e9d9fbd 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -42,8 +42,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "gimple-range.h"
 #include "dbgcnt.h"
 
-#include <utility>
-
 /* This file implements the loop unswitching, i.e. transformation of loops like
 
    while (A)
@@ -475,32 +473,30 @@ evaluate_insns (class loop *loop, basic_block *bbs,
       int flags = 0;
       basic_block bb = worklist.pop ();
 
-      if (EDGE_COUNT (bb->succs) == 2)
+      gimple *last = last_stmt (bb);
+      gcond *cond = last != NULL ? dyn_cast<gcond *> (last) : NULL;
+      if (cond != NULL)
 	{
-	  gcond *cond = dyn_cast<gcond *> (last_stmt (bb));
-	  if (cond != NULL)
+	  if (gimple_cond_true_p (cond))
+	    flags = EDGE_FALSE_VALUE;
+	  else if (gimple_cond_false_p (cond))
+	    flags = EDGE_TRUE_VALUE;
+	  else
 	    {
-	      if (gimple_cond_true_p (cond))
-		flags = EDGE_FALSE_VALUE;
-	      else if (gimple_cond_false_p (cond))
-		flags = EDGE_TRUE_VALUE;
-	      else
+	      // FIXME: works only for gconds
+	      unswitch_predicate *predicate = NULL;
+	      if (!get_predicates_for_bb (bb).is_empty ())
+		predicate = get_predicates_for_bb (bb)[0];
+
+	      if (predicate != NULL)
 		{
-		  // FIXME: works only for gconds
-		  unswitch_predicate *predicate = NULL;
-		  if (!get_predicates_for_bb (bb).is_empty ())
-		    predicate = get_predicates_for_bb (bb)[0];
-
-		  if (predicate != NULL)
-		    {
-		      tree folded
-			= evaluate_control_stmt_using_entry_checks (cond,
-								    predicate_path);
-		      if (folded == boolean_true_node)
-			flags = EDGE_FALSE_VALUE;
-		      else if (folded == boolean_false_node)
-			flags = EDGE_TRUE_VALUE;
-		    }
+		  tree folded
+		    = evaluate_control_stmt_using_entry_checks (cond,
+								predicate_path);
+		  if (folded == boolean_true_node)
+		    flags = EDGE_FALSE_VALUE;
+		  else if (folded == boolean_false_node)
+		    flags = EDGE_TRUE_VALUE;
 		}
 	    }
 	}


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

* [gcc(refs/users/marxin/heads/loop-unswitch-improvement-v7)] Simplify a bit.
@ 2021-12-07 16:49 Martin Liska
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Liska @ 2021-12-07 16:49 UTC (permalink / raw)
  To: gcc-cvs

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

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

    Simplify a bit.

Diff:
---
 gcc/tree-ssa-loop-unswitch.c | 46 ++++++++++++++++++++------------------------
 1 file changed, 21 insertions(+), 25 deletions(-)

diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 4bb108adc7c..7b5bd8afec7 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -41,8 +41,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "gimple-range.h"
 #include "dbgcnt.h"
 
-#include <utility>
-
 /* This file implements the loop unswitching, i.e. transformation of loops like
 
    while (A)
@@ -474,32 +472,30 @@ evaluate_insns (class loop *loop, basic_block *bbs,
       int flags = 0;
       basic_block bb = worklist.pop ();
 
-      if (EDGE_COUNT (bb->succs) == 2)
+      gimple *last = last_stmt (bb);
+      gcond *cond = last != NULL ? dyn_cast<gcond *> (last) : NULL;
+      if (cond != NULL)
 	{
-	  gcond *cond = dyn_cast<gcond *> (last_stmt (bb));
-	  if (cond != NULL)
+	  if (gimple_cond_true_p (cond))
+	    flags = EDGE_FALSE_VALUE;
+	  else if (gimple_cond_false_p (cond))
+	    flags = EDGE_TRUE_VALUE;
+	  else
 	    {
-	      if (gimple_cond_true_p (cond))
-		flags = EDGE_FALSE_VALUE;
-	      else if (gimple_cond_false_p (cond))
-		flags = EDGE_TRUE_VALUE;
-	      else
+	      // FIXME: works only for gconds
+	      unswitch_predicate *predicate = NULL;
+	      if (!get_predicates_for_bb (bb).is_empty ())
+		predicate = get_predicates_for_bb (bb)[0];
+
+	      if (predicate != NULL)
 		{
-		  // FIXME: works only for gconds
-		  unswitch_predicate *predicate = NULL;
-		  if (!get_predicates_for_bb (bb).is_empty ())
-		    predicate = get_predicates_for_bb (bb)[0];
-
-		  if (predicate != NULL)
-		    {
-		      tree folded
-			= evaluate_control_stmt_using_entry_checks (cond,
-								    predicate_path);
-		      if (folded == boolean_true_node)
-			flags = EDGE_FALSE_VALUE;
-		      else if (folded == boolean_false_node)
-			flags = EDGE_TRUE_VALUE;
-		    }
+		  tree folded
+		    = evaluate_control_stmt_using_entry_checks (cond,
+								predicate_path);
+		  if (folded == boolean_true_node)
+		    flags = EDGE_FALSE_VALUE;
+		  else if (folded == boolean_false_node)
+		    flags = EDGE_TRUE_VALUE;
 		}
 	    }
 	}


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

end of thread, other threads:[~2021-12-09 12:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-08 10:17 [gcc(refs/users/marxin/heads/loop-unswitch-improvement-v7)] Simplify a bit Martin Liska
  -- strict thread matches above, loose matches on Subject: below --
2021-12-09 12:47 Martin Liska
2021-12-08 18:25 Martin Liska
2021-12-07 16:49 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).