From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2066) id EA0C13848404; Wed, 9 Jun 2021 04:55:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EA0C13848404 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Jiu Fu Guo To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/guojiufu/heads/personal-branch)] bootstrap-O3 & regtest pass X-Act-Checkin: gcc X-Git-Author: Jiufu Guo X-Git-Refname: refs/users/guojiufu/heads/personal-branch X-Git-Oldrev: 380d6682d3e9217669cfb6e57b81a247d7094245 X-Git-Newrev: 0c125cb5ebb205913ed078a33c1498e15eb4d076 Message-Id: <20210609045508.EA0C13848404@sourceware.org> Date: Wed, 9 Jun 2021 04:55:07 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jun 2021 04:55:09 -0000 https://gcc.gnu.org/g:0c125cb5ebb205913ed078a33c1498e15eb4d076 commit 0c125cb5ebb205913ed078a33c1498e15eb4d076 Author: Jiufu Guo 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; }