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-v5)] Simplify usage of rangers.
Date: Mon,  8 Nov 2021 15:30:39 +0000 (GMT)	[thread overview]
Message-ID: <20211108153039.A2C1B3858428@sourceware.org> (raw)

https://gcc.gnu.org/g:0534ab9eebb1900fc172e014a515c94119c411ac

commit 0534ab9eebb1900fc172e014a515c94119c411ac
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Nov 8 15:52:26 2021 +0100

    Simplify usage of rangers.

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

diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index a509938c7d0..4b4bd471acd 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -383,29 +383,15 @@ tree_unswitch_single_loop (class loop *loop, int num)
 
       if (condition != NULL)
 	{
+	  tree result;
 	  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 (r.supports_type_p (TREE_TYPE (cond)))
+	  if (ranger.range_of_stmt (r, stmt) && r.singleton_p (&result))
 	    {
-	      if (ranger.range_on_edge (r, edge_true, cond)
-		  && r.undefined_p ())
-		{
-		  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))
-		      && r.undefined_p ())
-		{
-		  gimple_cond_set_condition_from_tree (condition,
-						       boolean_true_node);
-		  update_stmt (condition);
-		  changed = true;
-		}
+	      gimple_cond_set_condition_from_tree (condition,
+						   result);
+	      update_stmt (condition);
+	      changed = true;
 	    }
 	}
       else if (swtch != NULL)


             reply	other threads:[~2021-11-08 15:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-08 15:30 Martin Liska [this message]
2021-11-08 15:36 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=20211108153039.A2C1B3858428@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).