public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-1889] tree-optimization/106422 - verify block copying in forward threading Date: Fri, 29 Jul 2022 08:47:58 +0000 (GMT) [thread overview] Message-ID: <20220729084758.C768E3857C72@sourceware.org> (raw) https://gcc.gnu.org/g:4894ba078692a780a461d2f358b5dfaa25719859 commit r13-1889-g4894ba078692a780a461d2f358b5dfaa25719859 Author: Richard Biener <rguenther@suse.de> Date: Fri Jul 29 08:24:52 2022 +0200 tree-optimization/106422 - verify block copying in forward threading The forward threader failed to check whether it can actually duplicate blocks. The following adds this in a similar place the backwards threader performs this check. PR tree-optimization/106422 * tree-ssa-threadupdate.cc (fwd_jt_path_registry::update_cfg): Check whether we can copy thread blocks and cancel the thread if not. * gcc.dg/torture/pr106422.c: New testcase. Diff: --- gcc/testsuite/gcc.dg/torture/pr106422.c | 14 ++++++++++++++ gcc/tree-ssa-threadupdate.cc | 4 +++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.dg/torture/pr106422.c b/gcc/testsuite/gcc.dg/torture/pr106422.c new file mode 100644 index 00000000000..a2cef1aecb6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr106422.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ + +void vfork() __attribute__((__leaf__)); +void semanage_reload_policy(char *arg, void cb(void)) +{ + if (!arg) + { + cb(); + return; + } + vfork(); + if (arg) + __builtin_free(arg); +} diff --git a/gcc/tree-ssa-threadupdate.cc b/gcc/tree-ssa-threadupdate.cc index f901c7759e3..0f2b319d44a 100644 --- a/gcc/tree-ssa-threadupdate.cc +++ b/gcc/tree-ssa-threadupdate.cc @@ -2678,7 +2678,9 @@ fwd_jt_path_registry::update_cfg (bool may_peel_loop_headers) for (j = 0; j < path->length (); j++) { edge e = (*path)[j]->e; - if (m_removed_edges->find_slot (e, NO_INSERT)) + if (m_removed_edges->find_slot (e, NO_INSERT) + || ((*path)[j]->type == EDGE_COPY_SRC_BLOCK + && !can_duplicate_block_p (e->src))) break; }
reply other threads:[~2022-07-29 8:47 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=20220729084758.C768E3857C72@sourceware.org \ --to=rguenth@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).