public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jiu Fu Guo <guojiufu@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/guojiufu/heads/guojiufu-branch)] check EDGE_FALSE and update number insn checking later
Date: Wed,  9 Jun 2021 05:27:48 +0000 (GMT)	[thread overview]
Message-ID: <20210609052748.9F88A3988414@sourceware.org> (raw)

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

commit dfce3dcf332789b9685888bc22bca960d3455de9
Author: Jiufu Guo <guojiufu@linux.ibm.com>
Date:   Wed Jun 9 11:31:48 2021 +0800

    check EDGE_FALSE and update number insn checking later

Diff:
---
 gcc/tree-ssa-loop-split.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/gcc/tree-ssa-loop-split.c b/gcc/tree-ssa-loop-split.c
index 9c0de66e288..ca35eee21b7 100644
--- a/gcc/tree-ssa-loop-split.c
+++ b/gcc/tree-ssa-loop-split.c
@@ -1618,7 +1618,7 @@ get_ne_cond_branch (struct loop *loop)
 	continue;
       gcond *cond = as_a<gcond *> (last);
       enum tree_code code = gimple_cond_code (cond);
-      if (!(code == NE_EXPR
+      if (!((code == NE_EXPR && (e->flags & EDGE_FALSE_VALUE))
 	    || (code == EQ_EXPR && (e->flags & EDGE_TRUE_VALUE))))
 	continue;
 
@@ -1810,24 +1810,29 @@ The loop with "i<N" is in favor both GIMPLE and RTL passes.  */
 static bool
 split_loop_on_ne_cond (class loop *loop)
 {
+  edge branch_edge = get_ne_cond_branch (loop);
+  if (!branch_edge)
+    return false;
+
   int num = 0;
   basic_block *bbs = get_loop_body (loop);
+  for (unsigned i = 0; i < loop->num_nodes; i++)
+    num += estimate_num_insns_seq (bb_seq (bbs[i]), &eni_size_weights);
 
-  if (!can_copy_bbs_p (bbs, loop->num_nodes))
+  if (num > param_max_peeled_insns)
     {
       free (bbs);
       return false;
     }
 
-  for (unsigned i = 0; i < loop->num_nodes; i++)
-    num += estimate_num_insns_seq (bb_seq (bbs[i]), &eni_size_weights);
+  if (!can_copy_bbs_p (bbs, loop->num_nodes))
+    {
+      free (bbs);
+      return false;
+    }
   free (bbs);
 
-  if (num > param_max_peeled_insns)
-    return false;
-
-  edge branch_edge = get_ne_cond_branch (loop);
-  if (branch_edge && split_ne_loop (loop, branch_edge))
+  if (split_ne_loop (loop, branch_edge))
     return true;
 
   return false;


                 reply	other threads:[~2021-06-09  5:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210609052748.9F88A3988414@sourceware.org \
    --to=guojiufu@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).