public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Kewen Lin <linkw@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-2680] tree-cfg: Fix typos on dloop in move_sese_region_to_fn Date: Tue, 3 Aug 2021 03:13:35 +0000 (GMT) [thread overview] Message-ID: <20210803031335.ABE2D3851C3D@sourceware.org> (raw) https://gcc.gnu.org/g:daaed9e365a2b1371e30f619c7d9f19d1558a01b commit r12-2680-gdaaed9e365a2b1371e30f619c7d9f19d1558a01b Author: Kewen Lin <linkw@linux.ibm.com> Date: Mon Aug 2 22:12:00 2021 -0500 tree-cfg: Fix typos on dloop in move_sese_region_to_fn As mentioned in [1], there is one pre-existing issue before the refactoring of FOR_EACH_LOOP_FN. The macro will always set the given LOOP as NULL at the end of iterating unless there is some early break inside, obviously there is no early break and dloop will be set as NULL after the loop iterating. It's kept as NULL after the factoring. I tried to debug the test case gcc.dg/graphite/pr83359.c with commit 555758de90074 (also reproduced the ICE with 555758de90074~), and noticed the compilation of the test case only covers the hunk: else { moved_orig_loop_num[dloop->orig_loop_num] = -1; dloop->orig_loop_num = 0; } it doesn't touch the if condition hunk to increase "moved_orig_loop_num[dloop->orig_loop_num]". So the following hunk guarded with if (moved_orig_loop_num[orig_loop_num] == 2) using dloop for dereference doesn't get executed. It explains why the problem doesn't get exposed before. By looking to the code using dloop, I think it's a copy paste typo, the modified assertion codes have the same words as the above condition check. In that context, the expected original number has been assigned to variable orig_loop_num by extracting from the arg0 of the call IFN_LOOP_DIST_ALIAS. [1] https://gcc.gnu.org/pipermail/gcc-patches/2021-July/576367.html gcc/ChangeLog: * tree-cfg.c (move_sese_region_to_fn): Fix typos on dloop. Diff: --- gcc/tree-cfg.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 48ee8c011ab..9883eaaa9bf 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -7747,9 +7747,8 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, /* Fix up orig_loop_num. If the block referenced in it has been moved to dest_cfun, update orig_loop_num field, otherwise clear it. */ - class loop *dloop = NULL; signed char *moved_orig_loop_num = NULL; - for (class loop *dloop : loops_list (dest_cfun, 0)) + for (auto dloop : loops_list (dest_cfun, 0)) if (dloop->orig_loop_num) { if (moved_orig_loop_num == NULL) @@ -7787,11 +7786,10 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, /* If we have moved both loops with this orig_loop_num into dest_cfun and the LOOP_DIST_ALIAS call is being moved there too, update the first argument. */ - gcc_assert ((*larray)[dloop->orig_loop_num] != NULL - && (get_loop (saved_cfun, dloop->orig_loop_num) - == NULL)); + gcc_assert ((*larray)[orig_loop_num] != NULL + && (get_loop (saved_cfun, orig_loop_num) == NULL)); tree t = build_int_cst (integer_type_node, - (*larray)[dloop->orig_loop_num]->num); + (*larray)[orig_loop_num]->num); gimple_call_set_arg (g, 0, t); update_stmt (g); /* Make sure the following loop will not update it. */
reply other threads:[~2021-08-03 3:13 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=20210803031335.ABE2D3851C3D@sourceware.org \ --to=linkw@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).