From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2066) id C01DF385E449; Wed, 9 Jun 2021 04:55:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C01DF385E449 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)] EQ_EXPR and LE_EXPR ok X-Act-Checkin: gcc X-Git-Author: Jiufu Guo X-Git-Refname: refs/users/guojiufu/heads/personal-branch X-Git-Oldrev: 0c125cb5ebb205913ed078a33c1498e15eb4d076 X-Git-Newrev: 4acec8dc6f5b20eb940eb2b0b64da87cdd059dfa Message-Id: <20210609045518.C01DF385E449@sourceware.org> Date: Wed, 9 Jun 2021 04:55:12 +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:18 -0000 https://gcc.gnu.org/g:4acec8dc6f5b20eb940eb2b0b64da87cdd059dfa commit 4acec8dc6f5b20eb940eb2b0b64da87cdd059dfa Author: Jiufu Guo Date: Tue Jun 8 19:33:08 2021 +0800 EQ_EXPR and LE_EXPR ok Diff: --- gcc/tree-ssa-loop-split.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/gcc/tree-ssa-loop-split.c b/gcc/tree-ssa-loop-split.c index 13d6bea88ed..abc81a6144c 100644 --- a/gcc/tree-ssa-loop-split.c +++ b/gcc/tree-ssa-loop-split.c @@ -1667,9 +1667,15 @@ struct idx_elements bool analyze_idx_elements (class loop *loop, edge e, idx_elements &data) { + /* Avoid complicated edge. */ if (e->flags & EDGE_FAKE) return false; + if (e->src != loop->header && e->src != single_pred (loop->latch)) + return false; + if (!dominated_by_p (CDI_DOMINATORS, loop->latch, e->src)) + return false; + /* Check gcond. */ gimple *last = last_stmt (e->src); if (!last || gimple_code (last) != GIMPLE_COND) return false; @@ -1746,6 +1752,9 @@ get_wrap_assumption (class loop *loop, edge *exit, idx_elements &data) { int i; edge e; + if (!single_pred_p(loop->latch) || !empty_block_p (loop->latch)) + return NULL_TREE; + auto_vec edges = get_loop_exit_edges (loop); FOR_EACH_VEC_ELT (edges, i, e) { @@ -1767,7 +1776,9 @@ 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 (code != NE_EXPR) + if ((e->flags & EDGE_TRUE_VALUE) && code == EQ_EXPR) + code = NE_EXPR; + if (code != NE_EXPR && code != LT_EXPR) continue; /* Check if idx is iv with base and step. */ @@ -1849,7 +1860,6 @@ split_wrap_boundary (class loop *loop, edge e, tree no_wrap_cond) new_code = inv ? GT_EXPR : LT_EXPR; if (code == EQ_EXPR) { - new_code = invert_tree_comparison (new_code, false); edge out = EDGE_SUCC (e->src, 0); edge in = EDGE_SUCC (e->src, 1); if (in->flags & EDGE_TRUE_VALUE) @@ -1916,7 +1926,7 @@ split_loop_on_wrap (class loop *loop) tree no_wrap_assumption = get_wrap_assumption (loop, &e, data); if (no_wrap_assumption && split_wrap_boundary (loop, e, no_wrap_assumption)) - return true; + return true; return false; }