public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hubicka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/103052] [9/10/11/12 Regression] Function is found to be pure looping but has a call to a noreturn function in it
Date: Fri, 19 Nov 2021 12:47:27 +0000	[thread overview]
Message-ID: <bug-103052-4-L71ZBFTHE4@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103052-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103052

--- Comment #10 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
There is wrong order of conditionals in code merging previously known info with
current info. IPA propagation gets state NEITHER by walking around the
non-trivial cycle while function was earlier detected as PURE.

It is bit weird that IPA code does not ndetect PURE like local code. The catch
is that we get SCC involving noreturn edge which is not really a SCC for pure
analysis but it is SCC for const (since noreturn functions never modify global
memory after returning)

diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index a332940b55d..b438eb718a1 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -1782,9 +1782,9 @@ propagate_pure_const (void)
          if (w_l->state_previously_known != IPA_NEITHER
              && this_state > w_l->state_previously_known)
            {
-              this_state = w_l->state_previously_known;
              if (this_state == IPA_NEITHER)
-               this_looping = w_l->looping_previously_known;
+               this_looping = w_l->looping_previously_known;
+              this_state = w_l->state_previously_known;
            }
          if (!this_looping && self_recursive_p (w))
            this_looping = true;

  parent reply	other threads:[~2021-11-19 12:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-02 21:45 [Bug c/103052] New: Function call omitted at -O1 optimization level tor at ccxvii dot net
2021-11-02 22:04 ` [Bug c/103052] " jakub at gcc dot gnu.org
2021-11-02 22:09 ` tor at ccxvii dot net
2021-11-02 22:15 ` [Bug middle-end/103052] " pinskia at gcc dot gnu.org
2021-11-02 22:16 ` [Bug middle-end/103052] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
2021-11-02 22:19 ` tor at ccxvii dot net
2021-11-02 22:39 ` [Bug ipa/103052] " pinskia at gcc dot gnu.org
2021-11-02 22:41 ` pinskia at gcc dot gnu.org
2021-11-03  8:31 ` [Bug ipa/103052] [9/10/11/12 Regression] Function is found to be pure looping but has a call to a noreturn function in it rguenth at gcc dot gnu.org
2021-11-03  8:35 ` marxin at gcc dot gnu.org
2021-11-03  8:44 ` hubicka at gcc dot gnu.org
2021-11-19 12:47 ` hubicka at gcc dot gnu.org [this message]
2021-11-20 23:35 ` cvs-commit at gcc dot gnu.org
2021-11-20 23:40 ` cvs-commit at gcc dot gnu.org
2021-11-25 11:25 ` [Bug ipa/103052] [9/10/11 " cvs-commit at gcc dot gnu.org
2021-11-25 11:29 ` cvs-commit at gcc dot gnu.org
2021-11-25 13:29 ` cvs-commit at gcc dot gnu.org
2021-11-25 13:29 ` hubicka at gcc dot gnu.org

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=bug-103052-4-L71ZBFTHE4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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: link
Be 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).