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

https://gcc.gnu.org/g:1befd7e2e6d15192583b9f655ca88e53337a6fc0

commit 1befd7e2e6d15192583b9f655ca88e53337a6fc0
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Sep 13 17:22:26 2021 +0200

    Fix statement updating.

Diff:
---
 gcc/tree-ssa-loop-unswitch.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 0568c283c41..de8df78ca69 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -397,6 +397,7 @@ tree_unswitch_single_loop (class loop *loop, int num)
 		{
 		  gimple_cond_set_condition_from_tree (condition,
 						       boolean_false_node);
+		  update_stmt (condition);
 		  changed = true;
 		}
 	      else if(ranger.range_on_edge (r, edge_false, gimple_cond_lhs (stmt))
@@ -404,6 +405,7 @@ tree_unswitch_single_loop (class loop *loop, int num)
 		{
 		  gimple_cond_set_condition_from_tree (condition,
 						       boolean_true_node);
+		  update_stmt (condition);
 		  changed = true;
 		}
 	    }
@@ -433,14 +435,14 @@ tree_unswitch_single_loop (class loop *loop, int num)
 
 	  if (index_candidate != NULL_TREE
 	      && ignored_edges.elements () == EDGE_COUNT (bbs[i]->succs) - 1)
-	    gimple_switch_set_index (swtch, index_candidate);
+	    {
+	      gimple_switch_set_index (swtch, index_candidate);
+	      update_stmt (swtch);
+	    }
 	}
 
-      /* gswitch can return NULL_TREE for cases that are not supported.  */
-      if (cond == NULL_TREE)
-	;
       /* Do not unswitch too much.  */
-      else if (num > param_max_unswitch_level)
+      if (num > param_max_unswitch_level)
 	{
 	  i++;
 	  continue;
@@ -461,7 +463,6 @@ tree_unswitch_single_loop (class loop *loop, int num)
 	  break;
 	}
 
-      update_stmt (stmt);
       i++;
     }


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

* [gcc(refs/users/marxin/heads/loop-unswitching-switch-v3)] Fix statement updating.
@ 2021-09-13 15:22 Martin Liska
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Liska @ 2021-09-13 15:22 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:57ff620a903896bea83e04714560a8a8f651252c

commit 57ff620a903896bea83e04714560a8a8f651252c
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Sep 13 17:22:26 2021 +0200

    Fix statement updating.

Diff:
---
 gcc/tree-ssa-loop-unswitch.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 0568c283c41..de8df78ca69 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -397,6 +397,7 @@ tree_unswitch_single_loop (class loop *loop, int num)
 		{
 		  gimple_cond_set_condition_from_tree (condition,
 						       boolean_false_node);
+		  update_stmt (condition);
 		  changed = true;
 		}
 	      else if(ranger.range_on_edge (r, edge_false, gimple_cond_lhs (stmt))
@@ -404,6 +405,7 @@ tree_unswitch_single_loop (class loop *loop, int num)
 		{
 		  gimple_cond_set_condition_from_tree (condition,
 						       boolean_true_node);
+		  update_stmt (condition);
 		  changed = true;
 		}
 	    }
@@ -433,14 +435,14 @@ tree_unswitch_single_loop (class loop *loop, int num)
 
 	  if (index_candidate != NULL_TREE
 	      && ignored_edges.elements () == EDGE_COUNT (bbs[i]->succs) - 1)
-	    gimple_switch_set_index (swtch, index_candidate);
+	    {
+	      gimple_switch_set_index (swtch, index_candidate);
+	      update_stmt (swtch);
+	    }
 	}
 
-      /* gswitch can return NULL_TREE for cases that are not supported.  */
-      if (cond == NULL_TREE)
-	;
       /* Do not unswitch too much.  */
-      else if (num > param_max_unswitch_level)
+      if (num > param_max_unswitch_level)
 	{
 	  i++;
 	  continue;
@@ -461,7 +463,6 @@ tree_unswitch_single_loop (class loop *loop, int num)
 	  break;
 	}
 
-      update_stmt (stmt);
       i++;
     }


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

end of thread, other threads:[~2021-09-13 15:31 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:31 [gcc(refs/users/marxin/heads/loop-unswitching-switch-v3)] Fix statement updating Martin Liska
  -- strict thread matches above, loose matches on Subject: below --
2021-09-13 15:22 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).