public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/loop-unswitching-switch-v3)] Use ranger only for supported types.
@ 2021-09-13 15:30 Martin Liska
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Liska @ 2021-09-13 15:30 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:860179d2bcaed07965ce2d2507ebfb8dd384e3e0

commit 860179d2bcaed07965ce2d2507ebfb8dd384e3e0
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Sep 13 14:36:45 2021 +0200

    Use ranger only for supported types.

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

diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 347cbf443df..0568c283c41 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -388,20 +388,24 @@ tree_unswitch_single_loop (class loop *loop, int num)
 	  int_range_max r;
 	  edge edge_true, edge_false;
 	  extract_true_false_edges_from_block (bbs[i], &edge_true, &edge_false);
+	  tree cond = gimple_cond_lhs (stmt);
 
-	  if (ranger.range_on_edge (r, edge_true, gimple_cond_lhs (stmt))
-	      && r.undefined_p ())
+	  if (r.supports_type_p (TREE_TYPE (cond)))
 	    {
-	      gimple_cond_set_condition_from_tree (condition,
-						   boolean_false_node);
-	      changed = true;
-	    }
-	  else if(ranger.range_on_edge (r, edge_false, gimple_cond_lhs (stmt))
-	      && r.undefined_p ())
-	    {
-	      gimple_cond_set_condition_from_tree (condition,
-						   boolean_true_node);
-	      changed = true;
+	      if (ranger.range_on_edge (r, edge_true, cond)
+		  && r.undefined_p ())
+		{
+		  gimple_cond_set_condition_from_tree (condition,
+						       boolean_false_node);
+		  changed = true;
+		}
+	      else if(ranger.range_on_edge (r, edge_false, gimple_cond_lhs (stmt))
+		      && r.undefined_p ())
+		{
+		  gimple_cond_set_condition_from_tree (condition,
+						       boolean_true_node);
+		  changed = true;
+		}
 	    }
 	}
       else if (swtch != NULL)


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

* [gcc(refs/users/marxin/heads/loop-unswitching-switch-v3)] Use ranger only for supported types.
@ 2021-09-13 13:27 Martin Liska
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Liska @ 2021-09-13 13:27 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:060858206a530fe2c6f8d0f70651b63339f78c77

commit 060858206a530fe2c6f8d0f70651b63339f78c77
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Sep 13 14:36:45 2021 +0200

    Use ranger only for supported types.

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

diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 347cbf443df..0568c283c41 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -388,20 +388,24 @@ tree_unswitch_single_loop (class loop *loop, int num)
 	  int_range_max r;
 	  edge edge_true, edge_false;
 	  extract_true_false_edges_from_block (bbs[i], &edge_true, &edge_false);
+	  tree cond = gimple_cond_lhs (stmt);
 
-	  if (ranger.range_on_edge (r, edge_true, gimple_cond_lhs (stmt))
-	      && r.undefined_p ())
+	  if (r.supports_type_p (TREE_TYPE (cond)))
 	    {
-	      gimple_cond_set_condition_from_tree (condition,
-						   boolean_false_node);
-	      changed = true;
-	    }
-	  else if(ranger.range_on_edge (r, edge_false, gimple_cond_lhs (stmt))
-	      && r.undefined_p ())
-	    {
-	      gimple_cond_set_condition_from_tree (condition,
-						   boolean_true_node);
-	      changed = true;
+	      if (ranger.range_on_edge (r, edge_true, cond)
+		  && r.undefined_p ())
+		{
+		  gimple_cond_set_condition_from_tree (condition,
+						       boolean_false_node);
+		  changed = true;
+		}
+	      else if(ranger.range_on_edge (r, edge_false, gimple_cond_lhs (stmt))
+		      && r.undefined_p ())
+		{
+		  gimple_cond_set_condition_from_tree (condition,
+						       boolean_true_node);
+		  changed = true;
+		}
 	    }
 	}
       else if (swtch != NULL)


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

end of thread, other threads:[~2021-09-13 15:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13 15:30 [gcc(refs/users/marxin/heads/loop-unswitching-switch-v3)] Use ranger only for supported types Martin Liska
  -- strict thread matches above, loose matches on Subject: below --
2021-09-13 13:27 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).