public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: "Bin.Cheng" <amker.cheng@gmail.com>
Cc: Jeff Law <jeffreyalaw@gmail.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
	 "bin.cheng" <bin.cheng@linux.alibaba.com>
Subject: Re: 0001-Don-t-skip-prologue-instructions-as-it-could-affect-.patch
Date: Tue, 27 Jul 2021 10:59:59 +0200	[thread overview]
Message-ID: <CAFiYyc2PV0R3tQgP16JdL3E6QSsFM6OvTCpbWV7Q5yVY0Pz45w@mail.gmail.com> (raw)
In-Reply-To: <CAHFci29xK9Zf+uQVMBvom7gKCVgmL9Vg_sohv75REk6L=Qh+3w@mail.gmail.com>

On Tue, Jul 27, 2021 at 10:51 AM Bin.Cheng via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> On Mon, Jul 26, 2021 at 11:07 PM Jeff Law <jeffreyalaw@gmail.com> wrote:
> >
> >
> >
> > On 7/25/2021 7:47 PM, Bin.Cheng wrote:
> > > On Sat, Jul 24, 2021 at 12:30 AM Jeff Law via Gcc-patches
> > > <gcc-patches@gcc.gnu.org> wrote:
> > >>
> > >>
> > >> On 7/14/2021 3:14 AM, bin.cheng via Gcc-patches wrote:
> > >>> Hi,
> > >>> I ran into a wrong code bug in code with deep template instantiation when working on sdx::simd.
> > >>> The root cause as described in commit summary is we skip prologue insns in init_alias_analysis.
> > >>> This simple patch fixes the issue, however, it's hard to reduce a case because of heavy use of
> > >>> templates.
> > >>> Bootstrap and test on x86_64, is it OK?
> > >> It's a clear correctness improvement, but what's unclear to me is why
> > >> we'd want to skip them in the epilogue either.
> > > I can only guess, there is nothing to initialize epilogue for because
> > > no code follows.
> > Yea, but couldn't the lack of analysis of the epilogue lead to a pass
> > mis-optimizing code within the epilogue itself?  It's not terribly
> > likely, but it just seems wrong to skip the epilogue like this.
> > Remember, the aliasing bits are just an analysis phase to find the
> > aliasing relationships that exist and we don't necessarily know how that
> > data is going to be used.  It may in fact be safe now, but may not be
> > safe in the future if someone added a late RTL pass that used the
> > aliasing info in a new way.
> >
> > The more I think about it, the more I think we should remove remove this
> > hunk of code completely.  There is some chance for fallout, but I think
> > it's unlikely.
> Hi Jeff,
> Thanks for the suggestion, here is the simple patch removing all of it.
> diff --git a/gcc/alias.c b/gcc/alias.c
> index 69e1eb89ac6..099acabca6b 100644
> --- a/gcc/alias.c
> +++ b/gcc/alias.c
> @@ -3406,14 +3406,6 @@ init_alias_analysis (void)
>    rpo = XNEWVEC (int, n_basic_blocks_for_fn (cfun));
>    rpo_cnt = pre_and_rev_post_order_compute (NULL, rpo, false);
>
> -  /* The prologue/epilogue insns are not threaded onto the
> -     insn chain until after reload has completed.  Thus,
> -     there is no sense wasting time checking if INSN is in
> -     the prologue/epilogue until after reload has completed.  */
> -  bool could_be_prologue_epilogue = ((targetm.have_prologue ()
> -                                     || targetm.have_epilogue ())
> -                                    && reload_completed);
> -
>    pass = 0;
>    do
>      {
> @@ -3459,10 +3451,6 @@ init_alias_analysis (void)
>                 {
>                   rtx note, set;
>
> -                 if (could_be_prologue_epilogue
> -                     && prologue_epilogue_contains (insn))
> -                   continue;
> -
>                   /* If this insn has a noalias note, process it,  Otherwise,
>                      scan for sets.  A simple set will have no side effects
>                      which could change the base value of any other
> register.  */
>
> No fallouts in bootstrap/test on x86_64.  Is it OK?

OK.

Thanks,
Richard.

> Thanks,
> bin
> >
> > Jeff
> >

  reply	other threads:[~2021-07-27  9:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14  9:14 0001-Don-t-skip-prologue-instructions-as-it-could-affect-.patch bin.cheng
2021-07-22  7:01 ` 0001-Don-t-skip-prologue-instructions-as-it-could-affect-.patch Bin.Cheng
2021-07-22 13:04   ` 0001-Don-t-skip-prologue-instructions-as-it-could-affect-.patch Richard Biener
2021-07-22 23:36     ` 0001-Don-t-skip-prologue-instructions-as-it-could-affect-.patch Segher Boessenkool
2021-07-23 16:27     ` 0001-Don-t-skip-prologue-instructions-as-it-could-affect-.patch Jeff Law
2021-07-26 22:55       ` 0001-Don-t-skip-prologue-instructions-as-it-could-affect-.patch Segher Boessenkool
2021-07-27 15:20         ` 0001-Don-t-skip-prologue-instructions-as-it-could-affect-.patch Jeff Law
2021-07-22 23:51 ` 0001-Don-t-skip-prologue-instructions-as-it-could-affect-.patch Segher Boessenkool
2021-07-23  6:50   ` 0001-Don-t-skip-prologue-instructions-as-it-could-affect-.patch Bin.Cheng
2021-07-23 16:29 ` 0001-Don-t-skip-prologue-instructions-as-it-could-affect-.patch Jeff Law
2021-07-26  1:47   ` 0001-Don-t-skip-prologue-instructions-as-it-could-affect-.patch Bin.Cheng
2021-07-26 15:07     ` 0001-Don-t-skip-prologue-instructions-as-it-could-affect-.patch Jeff Law
2021-07-27  8:50       ` 0001-Don-t-skip-prologue-instructions-as-it-could-affect-.patch Bin.Cheng
2021-07-27  8:59         ` Richard Biener [this message]
2021-07-27 15:21         ` 0001-Don-t-skip-prologue-instructions-as-it-could-affect-.patch Jeff Law

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=CAFiYyc2PV0R3tQgP16JdL3E6QSsFM6OvTCpbWV7Q5yVY0Pz45w@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=amker.cheng@gmail.com \
    --cc=bin.cheng@linux.alibaba.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    /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).