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 r10-9828] tree-optimization/100566 - fix another predication issue in VN Date: Mon, 17 May 2021 07:47:18 +0000 (GMT) [thread overview] Message-ID: <20210517074718.CD7543857C7E@sourceware.org> (raw) https://gcc.gnu.org/g:9ddc622a15d05510e7ab17ca1584d7fdb828d64e commit r10-9828-g9ddc622a15d05510e7ab17ca1584d7fdb828d64e Author: Richard Biener <rguenther@suse.de> Date: Wed May 12 15:39:52 2021 +0200 tree-optimization/100566 - fix another predication issue in VN This amends the fix for PR100053 where I failed to amend all edge tests in dominated_by_p_w_unex. 2021-05-12 Richard Biener <rguenther@suse.de> PR tree-optimization/100566 * tree-ssa-sccvn.c (dominated_by_p_w_unex): Properly handle allow_back for all edge queries. * gcc.dg/torture/pr100566.c: New testcase. (cherry picked from commit 097fde5e7514e909f2e8472be2e008d0cab2260d) Diff: --- gcc/testsuite/gcc.dg/torture/pr100566.c | 36 +++++++++++++++++++++++++++++++++ gcc/tree-ssa-sccvn.c | 6 ++++-- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/gcc.dg/torture/pr100566.c b/gcc/testsuite/gcc.dg/torture/pr100566.c new file mode 100644 index 00000000000..ed856913639 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr100566.c @@ -0,0 +1,36 @@ +/* { dg-do run } */ + +volatile int s, c; + +__attribute__((noipa)) void +foo (void) +{ + if (c++ > 1) + __builtin_abort (); +} + +__attribute__((noipa)) int +bar (void) +{ + int i = 0, j = s; + if (j == 0) + goto lab; + for (i = 0; i < j; i++) + { + lab: + foo (); + if (!j) + goto lab; + } + return 0; +} + +int +main () +{ + s = 1; + bar (); + if (c != 1) + __builtin_abort (); + return 0; +} diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 9b0d730d11d..f6b1bd174c3 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -4448,7 +4448,8 @@ dominated_by_p_w_unex (basic_block bb1, basic_block bb2, bool allow_back) /* Iterate to the single executable bb2 successor. */ edge succe = NULL; FOR_EACH_EDGE (e, ei, bb2->succs) - if (e->flags & EDGE_EXECUTABLE) + if ((e->flags & EDGE_EXECUTABLE) + || (!allow_back && (e->flags & EDGE_DFS_BACK))) { if (succe) { @@ -4466,7 +4467,8 @@ dominated_by_p_w_unex (basic_block bb1, basic_block bb2, bool allow_back) { FOR_EACH_EDGE (e, ei, succe->dest->preds) if (e != succe - && (e->flags & EDGE_EXECUTABLE)) + && ((e->flags & EDGE_EXECUTABLE) + || (!allow_back && (e->flags & EDGE_DFS_BACK)))) { succe = NULL; break;
reply other threads:[~2021-05-17 7: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=20210517074718.CD7543857C7E@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).