public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/guojiufu/heads/guojiufu-branch)] code clean up
@ 2021-06-02  7:57 Jiu Fu Guo
  0 siblings, 0 replies; only message in thread
From: Jiu Fu Guo @ 2021-06-02  7:57 UTC (permalink / raw)
  To: gcc-cvs

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

commit af5f15731f42db52208e78de2fdb1c3699a1bdb0
Author: Jiufu Guo <guojiufu@linux.ibm.com>
Date:   Wed Jun 2 13:52:25 2021 +0800

    code clean up

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

diff --git a/gcc/tree-ssa-loop-split.c b/gcc/tree-ssa-loop-split.c
index 926966a2bbc..791508e4f03 100644
--- a/gcc/tree-ssa-loop-split.c
+++ b/gcc/tree-ssa-loop-split.c
@@ -1675,31 +1675,23 @@ get_ne_cond_branch (struct loop *loop)
 	  if (!gsi_end_p (psi))
 	    continue;
 
-	  /* Get the idx from last stmt (the gcond) of bb.  */
-	  gimple *gc = last_stmt (bb);
-	  gcc_assert (gimple_code (gc) == GIMPLE_COND);
-	  tree idx = gimple_cond_lhs (gc);
-	  if (expr_invariant_in_loop_p (loop, idx))
-	    idx = gimple_cond_rhs (gc);
-
+	  /* Check it is ++i or ++i */
 	  tree next = PHI_ARG_DEF_FROM_EDGE (phi, loop_latch_edge (loop));
 	  tree prev = PHI_RESULT (phi);
 	  if (idx != prev && idx != next)
 	    continue;
 
-	  /* ++i or ++i */
 	  gimple_stmt_iterator gsi
 	    = gsi_start_nondebug_after_labels_bb (bb);
 	  if (gsi_end_p (gsi))
 	    continue;
-
 	  gimple *s1 = gsi_stmt (gsi);
 	  if (!is_gimple_assign (s1) || gimple_assign_lhs (s1) != next
 	      || gimple_assign_rhs1 (s1) != prev)
 	    continue;
 
 	  gsi_next (&gsi);
-	  if (!gsi_end_p (gsi) && gsi_stmt (gsi) == gc)
+	  if (!gsi_end_p (gsi) && gsi_stmt (gsi) == cond)
 	    return e;
 	}
     }
@@ -1741,7 +1733,7 @@ split_ne_loop (struct loop *loop, edge cond_e)
   gcond *break_cond = as_a<gcond *> (gimple_copy (gc));
   edge pred_e = single_pred_edge (loop->latch);
   bool simple_loop = pred_e && pred_e->src == cond_e->src
-		     && (gsi_end_p (gsi_start_nondebug_bb (loop->latch)));
+		     && empty_block_p (loop->latch);
   if (simple_loop)
     gimple_cond_set_code (break_cond, down_code);
   else


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

only message in thread, other threads:[~2021-06-02  7:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-02  7:57 [gcc(refs/users/guojiufu/heads/guojiufu-branch)] code clean up 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).