public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/guojiufu/heads/personal-branch)] bootstrap-O3 & regtest pass
@ 2021-06-09  4:55 Jiu Fu Guo
  0 siblings, 0 replies; only message in thread
From: Jiu Fu Guo @ 2021-06-09  4:55 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0c125cb5ebb205913ed078a33c1498e15eb4d076

commit 0c125cb5ebb205913ed078a33c1498e15eb4d076
Author: Jiufu Guo <guojiufu@linux.ibm.com>
Date:   Mon Jun 7 11:30:54 2021 +0800

    bootstrap-O3 & regtest pass

Diff:
---
 gcc/tree-ssa-loop-split.c | 92 +++--------------------------------------------
 1 file changed, 4 insertions(+), 88 deletions(-)

diff --git a/gcc/tree-ssa-loop-split.c b/gcc/tree-ssa-loop-split.c
index 185b8a995cd..13d6bea88ed 100644
--- a/gcc/tree-ssa-loop-split.c
+++ b/gcc/tree-ssa-loop-split.c
@@ -1694,7 +1694,7 @@ analyze_idx_elements (class loop *loop, edge e, idx_elements &data)
   if (is_gimple_assign (stmt))
     {
       tree rhs =  gimple_assign_rhs1 (stmt);
-      if (TREE_CODE (rhs) == SSA_NAME)
+      if (TREE_CODE (rhs) != SSA_NAME)
 	return false;
 
       cmp_next = true;
@@ -1767,9 +1767,7 @@ get_wrap_assumption (class loop *loop, edge *exit, idx_elements &data)
       enum tree_code code = gimple_cond_code (gc);
       if (bnd == gimple_cond_lhs (gc))
 	code = swap_tree_comparison (code);
-      if (e->flags & EDGE_TRUE_VALUE)
-	code = invert_tree_comparison (code, false);
-      if (code != NE_EXPR && code != LT_EXPR && code != LE_EXPR)
+      if (code != NE_EXPR)
 	continue;
 
       /* Check if idx is iv with base and step.  */
@@ -1814,83 +1812,6 @@ get_wrap_assumption (class loop *loop, edge *exit, idx_elements &data)
   return NULL_TREE;
 }
 
-/*  Update the idx and bnd with faster type for no wrap/oveflow loop.  */
-
-static bool
-update_idx_bnd_type (class loop *loop, idx_elements &data)
-{
-  /* Use sizetype as machine fast type, ok for most targets?  */
-  tree fast_type = sizetype;
-
-  /* New base and new bound.  */
-  gphi *phi = data.phi;
-  tree bnd = data.bnd;
-  edge pre_e = loop_preheader_edge (loop);
-  tree base = PHI_ARG_DEF_FROM_EDGE (phi, pre_e);
-  tree new_base = fold_convert (fast_type, base);
-  tree new_bnd = fold_convert (fast_type, bnd);
-  gimple_seq seq = NULL;
-  new_base = force_gimple_operand (new_base, &seq, true, NULL_TREE);
-  if (seq)
-    gsi_insert_seq_on_edge_immediate (pre_e, seq);
-  seq = NULL;
-  new_bnd = force_gimple_operand (new_bnd, &seq, true, NULL_TREE);
-  if (seq)
-    gsi_insert_seq_on_edge_immediate (pre_e, seq);
-
-  /* new_i = phi (new_b, new_n)
-     new_n = new_i + 1   */
-  edge latch_e = loop_latch_edge (loop);
-  const char *name = "idx";
-  tree new_idx = make_temp_ssa_name (fast_type, NULL, name);
-  tree new_next = make_temp_ssa_name (fast_type, NULL, name);
-  gphi *newphi = create_phi_node (new_idx, loop->header);
-  add_phi_arg (newphi, new_base, pre_e, UNKNOWN_LOCATION);
-  add_phi_arg (newphi, new_next, latch_e, UNKNOWN_LOCATION);
-
-  /* New increase stmt.  */
-  gimple *inc_stmt = data.inc_stmt;
-  tree step = gimple_assign_rhs2 (inc_stmt);
-  step = fold_convert (fast_type, step);
-  new_idx = PHI_RESULT (newphi);
-  tree_code inc_code = gimple_assign_rhs_code (inc_stmt);
-  gimple *new_inc = gimple_build_assign (new_next, inc_code, new_idx, step);
-  gimple_stmt_iterator gsi = gsi_for_stmt (inc_stmt);
-  gsi_insert_before (&gsi, new_inc, GSI_SAME_STMT);
-
-  /* Update gcond.  */
-  gcond *gc = data.gc;
-  bool inv = bnd == gimple_cond_lhs (gc);
-  tree cmp_idx = data.cmp_on_next ? new_next : new_idx;
-  gimple_cond_set_lhs (gc, inv ? new_bnd : cmp_idx);
-  gimple_cond_set_rhs (gc, inv ? cmp_idx : new_bnd);
-  update_stmt (gc);
-
-  /* next = (next type)new_next
-     And remove next = prev + 1.  */
-  tree next = data.next;
-  tree type = TREE_TYPE (next);
-  gimple *stmt = gimple_build_assign (next, fold_convert (type, new_next));
-  gsi = gsi_for_stmt (inc_stmt);
-  gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
-
-  gsi = gsi_for_stmt (inc_stmt);
-  gsi_remove (&gsi, true);
-
-  /* prev = (prev type)new_prev
-     And remove prev = phi.  */
-  tree idx = PHI_RESULT (phi);
-  type = TREE_TYPE (idx);
-  stmt = gimple_build_assign (idx, fold_convert (type, new_idx));
-  gsi = gsi_start_bb (loop->header);
-  gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
-
-  gsi = gsi_for_stmt (phi);
-  gsi_remove (&gsi, true);
-
-  return true;
-}
-
 /* Split out a new loop which would not wrap,
    under the guard that NO_WRAP_COND will not be true. */
 
@@ -1994,13 +1915,8 @@ split_loop_on_wrap (class loop *loop)
   idx_elements data;
   tree no_wrap_assumption = get_wrap_assumption (loop, &e, data);
 
-  if (no_wrap_assumption
-      && (integer_onep (no_wrap_assumption)
-	  || split_wrap_boundary (loop, e, no_wrap_assumption)))
-    {
-      update_idx_bnd_type (loop, data);
-      return true;
-    }
+  if (no_wrap_assumption && split_wrap_boundary (loop, e, no_wrap_assumption))
+    return true;
 
   return false;
 }


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

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

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09  4:55 [gcc(refs/users/guojiufu/heads/personal-branch)] bootstrap-O3 & regtest pass 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).