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-unswitch-improvement)] Small while(1) loop refactoring.
Date: Fri, 19 Nov 2021 14:34:19 +0000 (GMT)	[thread overview]
Message-ID: <20211119143419.7F9973857C6A@sourceware.org> (raw)

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

commit c102dee76451b1ca8f2e976ca922b4ead958024b
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Nov 15 13:17:24 2021 +0100

    Small while(1) loop refactoring.

Diff:
---
 gcc/tree-ssa-loop-unswitch.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index fe4dacc0833..d77914e2ba5 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -307,11 +307,10 @@ tree_unswitch_single_loop (class loop *loop, int num)
 	}
     }
 
-  i = 0;
   bbs = get_loop_body (loop);
   found = loop->num_nodes;
 
-  while (1)
+  for (unsigned i = 0; true; i++)
     {
       /* Find a bb to unswitch on.  */
       for (; i < loop->num_nodes; i++)
@@ -351,10 +350,7 @@ tree_unswitch_single_loop (class loop *loop, int num)
 	}
       /* Do not unswitch too much.  */
       else if (num > param_max_unswitch_level)
-	{
-	  i++;
-	  continue;
-	}
+	continue;
       /* In nested tree_unswitch_single_loop first optimize all conditions
 	 using entry checks, then discover still reachable blocks in the
 	 loop and find the condition only among those still reachable bbs.  */
@@ -362,7 +358,6 @@ tree_unswitch_single_loop (class loop *loop, int num)
 	{
 	  if (found == loop->num_nodes)
 	    found = i;
-	  i++;
 	  continue;
 	}
       else
@@ -372,7 +367,6 @@ tree_unswitch_single_loop (class loop *loop, int num)
 	}
 
       update_stmt (stmt);
-      i++;
     }
 
   if (num != 0)


             reply	other threads:[~2021-11-19 14:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-19 14:34 Martin Liska [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-11-22 12:44 Martin Liska
2021-11-19 13:53 Martin Liska
2021-11-16  9:46 Martin Liska
2021-11-15 15:48 Martin Liska
2021-11-15 14:23 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=20211119143419.7F9973857C6A@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).