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)] check SSA_NAME before get stmt Date: Fri, 4 Jun 2021 12:06:43 +0000 (GMT) [thread overview] Message-ID: <20210604120643.E02AA3848420@sourceware.org> (raw) https://gcc.gnu.org/g:dc96ca531a2f79b99f942b98b3660fa8e2b672ab commit dc96ca531a2f79b99f942b98b3660fa8e2b672ab Author: guojiufu <guojiufu@linux.ibm.com> Date: Thu Jun 3 18:39:47 2021 +0800 check SSA_NAME before get stmt Diff: --- gcc/tree-ssa-loop-split.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/gcc/tree-ssa-loop-split.c b/gcc/tree-ssa-loop-split.c index a35a7d19814..7df406e72fb 100644 --- a/gcc/tree-ssa-loop-split.c +++ b/gcc/tree-ssa-loop-split.c @@ -1614,6 +1614,7 @@ static gimple * filter_conversions (class loop *loop, tree idx, tree *small_type = NULL, tree *large_type = NULL) { + gcc_assert (TREE_CODE (idx) == SSA_NAME); gimple *stmt = SSA_NAME_DEF_STMT (idx); while (is_gimple_assign (stmt) && flow_bb_inside_loop_p (loop, gimple_bb (stmt))) @@ -1705,10 +1706,18 @@ get_wrap_assumption (class loop *loop, edge *exit) /* Get the phi for idx. */ gimple *stmt = filter_conversions (loop, idx); if (is_gimple_assign (stmt)) - stmt = filter_conversions (loop, gimple_assign_rhs1 (stmt)); - if (gimple_code (stmt) != GIMPLE_PHI) + { + tree rhs = gimple_assign_rhs1 (stmt); + if (TREE_CODE (rhs) != SSA_NAME) + continue; + stmt = filter_conversions (loop, rhs); + } + if (gimple_code (stmt) != GIMPLE_PHI || gimple_bb (stmt) != loop->header) continue; gphi *idx_phi = as_a<gphi *> (stmt); + tree next = PHI_ARG_DEF_FROM_EDGE (idx_phi, loop_latch_edge (loop)); + if (TREE_CODE (next) != SSA_NAME) + continue; /* Check if idx is iv with base and step. */ affine_iv iv; @@ -1722,7 +1731,6 @@ get_wrap_assumption (class loop *loop, edge *exit) /* If there is conversions on idx, Get the longest and shortest type during converting. */ - tree next = PHI_ARG_DEF_FROM_EDGE (idx_phi, loop_latch_edge (loop)); tree small_type = TREE_TYPE (next); tree large_type = small_type; stmt = filter_conversions (loop, next, &small_type, &large_type); @@ -1731,6 +1739,8 @@ get_wrap_assumption (class loop *loop, edge *exit) || !flow_bb_inside_loop_p (loop, gimple_bb (stmt))) continue; tree prev = gimple_assign_rhs1 (stmt); + if (TREE_CODE (prev) != SSA_NAME) + continue; stmt = filter_conversions (loop, prev, &small_type, &large_type); /* Update the type of bae, bound and the max value of boundary. */ @@ -1768,6 +1778,7 @@ get_wrap_assumption (class loop *loop, edge *exit) static bool update_idx_bnd_type (class loop *loop, edge e) { + return false; /* Get bnd and idx from gcond. */ gimple *last = last_stmt (e->src); if (!last || gimple_code (last) != GIMPLE_COND) @@ -1790,11 +1801,13 @@ update_idx_bnd_type (class loop *loop, edge e) And check the exit gcond is comparing on the prev or next. */ gimple *inc_stmt = NULL; bool cmp_next = false; + gcc_assert (TREE_CODE (idx) == SSA_NAME); gimple *stmt = filter_conversions (loop, idx); if (gimple_code (stmt) == GIMPLE_PHI) { idx_phi = as_a <gphi *> (stmt); next = PHI_ARG_DEF_FROM_EDGE (idx_phi, latch_e); + gcc_assert (TREE_CODE (next) == SSA_NAME); inc_stmt = filter_conversions (loop, next); cmp_next = false; } @@ -1803,7 +1816,9 @@ update_idx_bnd_type (class loop *loop, edge e) inc_stmt = stmt; if (!is_gimple_assign (inc_stmt)) return false; - stmt = filter_conversions (loop, gimple_assign_rhs1 (stmt)); + tree rhs = gimple_assign_rhs1 (stmt); + gcc_assert (TREE_CODE (rhs) == SSA_NAME); + stmt = filter_conversions (loop, rhs); if (gimple_code (stmt) != GIMPLE_PHI) return false; idx_phi = as_a<gphi *> (stmt);
reply other threads:[~2021-06-04 12:06 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=20210604120643.E02AA3848420@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).