public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Bernd Schmidt <bschmidt@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: fwprop fix for PR79405
Date: Fri, 17 Feb 2017 09:11:00 -0000	[thread overview]
Message-ID: <CAFiYyc2yrrZ4JOPOFdtRAU9B_RaoPxViq2EdLdSdeboZgLs2aA@mail.gmail.com> (raw)
In-Reply-To: <328a765e-5466-9740-d545-c1a620805ef9@redhat.com>

On Thu, Feb 16, 2017 at 8:41 PM, Bernd Schmidt <bschmidt@redhat.com> wrote:
> We have two registers being assigned to each other:
>
>  (set (reg 213) (reg 209))
>  (set (reg 209) (reg 213))
>
> These being the only definitions, we are happy to forward propagate reg 209
> for reg 213 into a third insn, making a new use for reg 209. We are then
> happy to forward propagate reg 213 for it in the same insn... ending up in
> an infinite loop.
>
> I don't really see an elegant way to prevent this, so the following just
> tries to detect the situation (and more general ones) by brute force.
> Bootstrapped and tested on x86_64-linux, verified that the test passes with
> a ppc cross, ok?

But isn't the issue that we are walking "all uses" (in random order) rather than
only processing each stmt once?  That is,

  /* Go through all the uses.  df_uses_create will create new ones at the
     end, and we'll go through them as well.

     Do not forward propagate addresses into loops until after unrolling.
     CSE did so because it was able to fix its own mess, but we are not.  */

  for (i = 0; i < DF_USES_TABLE_SIZE (); i++)
    {
      df_ref use = DF_USES_GET (i);
      if (use)
        if (DF_REF_TYPE (use) == DF_REF_REG_USE
            || DF_REF_BB (use)->loop_father == NULL
            /* The outer most loop is not really a loop.  */
            || loop_outer (DF_REF_BB (use)->loop_father) == NULL)
          forward_propagate_into (use);
    }

if that were simply walking all instructions, doing forward_propagat_into on
each use on an instruction we'd avoid the cycle (because we stop propagating).

Because when propagating DF_USES_TABLE changes.

Richard.


>
>
> Bernd
>

  reply	other threads:[~2017-02-17  9:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-16 19:44 Bernd Schmidt
2017-02-17  9:11 ` Richard Biener [this message]
2017-02-17  9:21   ` Richard Biener
2017-02-20 14:02     ` Bernd Schmidt
2017-02-20 17:15       ` Richard Biener
2017-02-22 17:54 ` Jeff Law
2017-02-23  9:02   ` Richard Biener
2017-02-23 22:21     ` Jeff Law
2017-02-24 10:08       ` Richard Biener

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=CAFiYyc2yrrZ4JOPOFdtRAU9B_RaoPxViq2EdLdSdeboZgLs2aA@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=bschmidt@redhat.com \
    --cc=gcc-patches@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).