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/personal-branch)] Boostrap-O3 for NE
Date: Mon, 14 Jun 2021 03:28:03 +0000 (GMT)	[thread overview]
Message-ID: <20210614032804.78FE8384843D@sourceware.org> (raw)

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

commit c34237a1dab039682b7d7239f1470e840c3a7588
Author: Jiufu Guo <guojiufu@linux.ibm.com>
Date:   Fri Jun 11 17:58:16 2021 +0800

    Boostrap-O3 for NE

Diff:
---
 gcc/tree-ssa-loop-split.c | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/gcc/tree-ssa-loop-split.c b/gcc/tree-ssa-loop-split.c
index 688d26aecaf..209a26d9b53 100644
--- a/gcc/tree-ssa-loop-split.c
+++ b/gcc/tree-ssa-loop-split.c
@@ -1724,9 +1724,10 @@ analyze_idx_elements (class loop *loop, edge e, idx_elements &data)
       || !flow_bb_inside_loop_p (loop, gimple_bb (stmt)))
     return false;
   tree_code rhs_code = gimple_assign_rhs_code (stmt);
-  if (rhs_code != PLUS_EXPR && rhs_code != MINUS_EXPR)
+  if (rhs_code != PLUS_EXPR)
     return false;
-  if (TREE_CODE (gimple_assign_rhs2 (stmt)) != INTEGER_CST)
+  tree step = gimple_assign_rhs2 (stmt);
+  if (!integer_onep (step))
     return false;
   inc_stmt = stmt;
   tree prev = gimple_assign_rhs1 (stmt);
@@ -1835,12 +1836,20 @@ get_wrap_assumption (class loop *loop, edge *exit, idx_elements &data)
 static bool
 update_idx_bnd_type (class loop *loop, idx_elements &data)
 {
+  gphi *phi = data.phi;
+  tree type = TREE_TYPE (PHI_RESULT (phi));
   tree suitable_type = data.large_type;
+  if (TYPE_PRECISION (type) == TYPE_PRECISION (suitable_type)
+      && (TYPE_UNSIGNED (suitable_type) == TYPE_UNSIGNED (type)))
+    return false;
   if (TYPE_UNSIGNED (suitable_type))
-    suitable_type = sizetype;
+    {
+      if (TYPE_PRECISION (suitable_type) == TYPE_PRECISION (sizetype))
+	return false;
+      suitable_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);
@@ -1885,8 +1894,8 @@ update_idx_bnd_type (class loop *loop, idx_elements &data)
 
   /* next = (next type)new_next
      And remove next = prev + 1.  */
-  tree next = gimple_assign_lhs (inc_stmt); 
-  tree type = TREE_TYPE (next);
+  tree next = gimple_assign_lhs (inc_stmt);
+  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);
@@ -2018,8 +2027,10 @@ split_loop_on_wrap (class loop *loop)
 
   free (bbs);
 
-  if (integer_onep (no_wrap_assumption)
-      || split_wrap_boundary (loop, e, no_wrap_assumption))
+  if (integer_onep (no_wrap_assumption))
+    return update_idx_bnd_type (loop, data);
+
+  if (split_wrap_boundary (loop, e, no_wrap_assumption))
     {
       update_idx_bnd_type (loop, data);
       return true;


                 reply	other threads:[~2021-06-14  3:28 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=20210614032804.78FE8384843D@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).