public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/marxin/heads/loop-unswitching-switch-v3)] Fix statement updating.
Date: Mon, 13 Sep 2021 15:31:12 +0000 (GMT)	[thread overview]
Message-ID: <20210913153112.8732A3857433@sourceware.org> (raw)

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++;
     }


             reply	other threads:[~2021-09-13 15:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13 15:31 Martin Liska [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-09-13 15:22 Martin Liska

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210913153112.8732A3857433@sourceware.org \
    --to=marxin@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).