public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Jan Hubicka <hubicka@kam.mff.cuni.cz>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: Fix recursion discovery in ipa-pure-const
Date: Thu, 11 Nov 2021 15:30:29 +0100	[thread overview]
Message-ID: <CAFiYyc0UrwVshWkuyZn1cHQ+iJ2nMLSc4xUXwfHM6m_DQMFcCw@mail.gmail.com> (raw)
In-Reply-To: <20211111134037.GF17431@kam.mff.cuni.cz>

On Thu, Nov 11, 2021 at 2:41 PM Jan Hubicka via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi,
> We make self recursive functions as looping of fear of endless recursion.
> This is done correctly for local pure/const and for non-trivial SCCs in
> callgraph, but for trivial SCCs we miss the flag.
>
> I think it is bad decision since infinite recursion will run out of stack,

Note it might not always in case we can eliminate the tail-recursion or avoid
stack use by the recursion by other means.  So I think it is conservatively
correct.

Richard.

> but changing it upsets some testcases and should be done independently.
> So this patch is fixing current behaviour to be consistent.
>
> Bootstrapped/regtested x86_64-linux, comitted.
>
> gcc/ChangeLog:
>
> 2021-11-11  Jan Hubicka  <hubicka@ucw.cz>
>
>         * ipa-pure-const.c (propagate_pure_const): Self recursion is
>         a side effects.
>
> diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
> index 505ed4f8a3b..64777cd2d91 100644
> --- a/gcc/ipa-pure-const.c
> +++ b/gcc/ipa-pure-const.c
> @@ -1513,6 +1611,9 @@ propagate_pure_const (void)
>               enum pure_const_state_e edge_state = IPA_CONST;
>               bool edge_looping = false;
>
> +             if (e->recursive_p ())
> +               looping = true;
> +
>               if (dump_file && (dump_flags & TDF_DETAILS))
>                 {
>                   fprintf (dump_file, "    Call to %s",

  reply	other threads:[~2021-11-11 14:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11 13:40 Jan Hubicka
2021-11-11 14:30 ` Richard Biener [this message]
2021-11-11 14:53   ` Jan Hubicka

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=CAFiYyc0UrwVshWkuyZn1cHQ+iJ2nMLSc4xUXwfHM6m_DQMFcCw@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@kam.mff.cuni.cz \
    /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).