public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/guojiufu/heads/guojiufu-branch)] check EDGE_FALSE and update number insn checking later
@ 2021-06-09  5:27 Jiu Fu Guo
  0 siblings, 0 replies; only message in thread
From: Jiu Fu Guo @ 2021-06-09  5:27 UTC (permalink / raw)
  To: gcc-cvs

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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-09  5:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09  5:27 [gcc(refs/users/guojiufu/heads/guojiufu-branch)] check EDGE_FALSE and update number insn checking later Jiu Fu Guo

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).