public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Andrew Macleod <amacleod@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-5694] Reset SCEV before removing unreachable globals. Date: Fri, 3 Feb 2023 19:43:13 +0000 (GMT) [thread overview] Message-ID: <20230203194313.D22493858C52@sourceware.org> (raw) https://gcc.gnu.org/g:093e2e1b201c0f324e0d8bfe6487aa2d470a13e7 commit r13-5694-g093e2e1b201c0f324e0d8bfe6487aa2d470a13e7 Author: Andrew MacLeod <amacleod@redhat.com> Date: Wed Feb 1 11:46:18 2023 -0500 Reset SCEV before removing unreachable globals. SCEV should be reset in VRP before trying to remove unreachable globals to avoid triggering issues with it's cache. PR tree-optimization/107570 gcc/ * tree-vrp.cc (remove_and_update_globals): Reset SCEV. gcc/testsuite/ * gcc.dg/pr107570.c: New. Diff: --- gcc/testsuite/gcc.dg/pr107570.c | 25 +++++++++++++++++++++++++ gcc/tree-vrp.cc | 4 ++++ 2 files changed, 29 insertions(+) diff --git a/gcc/testsuite/gcc.dg/pr107570.c b/gcc/testsuite/gcc.dg/pr107570.c new file mode 100644 index 00000000000..ba5b535a867 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr107570.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-Os" } */ + +long int n; + +void +foo (int *p, int x) +{ + for (;;) + { + for (*p = 0; *p < 1; ++*p) + { + n += *p < 0; + if (n < x) + { + while (x < 1) + ++x; + + __builtin_unreachable (); + } + } + + p = &x; + } +} diff --git a/gcc/tree-vrp.cc b/gcc/tree-vrp.cc index 3c431760a16..95547e5419b 100644 --- a/gcc/tree-vrp.cc +++ b/gcc/tree-vrp.cc @@ -121,6 +121,10 @@ remove_unreachable::remove_and_update_globals (bool final_p) if (m_list.length () == 0) return false; + // Ensure the cache in SCEV has been cleared before processing + // globals to be removed. + scev_reset (); + bool change = false; tree name; unsigned i;
reply other threads:[~2023-02-03 19:43 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=20230203194313.D22493858C52@sourceware.org \ --to=amacleod@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).