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)] EQ_EXPR and LE_EXPR ok Date: Wed, 9 Jun 2021 04:55:12 +0000 (GMT) [thread overview] Message-ID: <20210609045518.C01DF385E449@sourceware.org> (raw) https://gcc.gnu.org/g:4acec8dc6f5b20eb940eb2b0b64da87cdd059dfa commit 4acec8dc6f5b20eb940eb2b0b64da87cdd059dfa Author: Jiufu Guo <guojiufu@linux.ibm.com> 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<edge> 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; }
reply other threads:[~2021-06-09 4:55 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=20210609045518.C01DF385E449@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: linkBe 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).