From: Richard Biener <rguenther@suse.de>
To: Richard Sandiford <richard.sandiford@arm.com>
Cc: Jiufu Guo <guojiufu@linux.ibm.com>,
Segher Boessenkool <segher@kernel.crashing.org>,
gcc-patches@gcc.gnu.org, dje.gcc@gmail.com, linkw@gcc.gnu.org,
bergner@linux.ibm.com, jeffreyalaw@gmail.com
Subject: Re: [PATCH] rs6000: replace '(const_int 0)' to 'unspec:BLK [(const_int 0)]' for stack_tie
Date: Wed, 14 Jun 2023 09:52:37 +0000 (UTC) [thread overview]
Message-ID: <nycvar.YFH.7.77.849.2306140950020.4723@jbgna.fhfr.qr> (raw)
In-Reply-To: <mpto7liidkg.fsf@arm.com>
On Wed, 14 Jun 2023, Richard Sandiford wrote:
> Richard Biener <rguenther@suse.de> writes:
> > On Wed, 14 Jun 2023, Richard Sandiford wrote:
> >
> >> Richard Biener <rguenther@suse.de> writes:
> >> > AFAIU this special instruction is only supposed to prevent
> >> > code motion (of stack memory accesses?) across this instruction?
> >> > I'd say a
> >> >
> >> > (may_clobber (mem:BLK (reg:DI 1 1)))
> >> >
> >> > might be more to the point? I've used "may_clobber" which doesn't
> >> > exist since I'm not sure whether a clobber is considered a kill.
> >> > The docs say "Represents the storing or possible storing of an
> >> > unpredictable..." - what is it? Storing or possible storing?
> >>
> >> I'd also understood it to be either. As in, it is a may-clobber
> >> that can be used for must-clobber. Alternatively: the value stored
> >> is unpredictable, and can therefore be the same as the current value.
> >>
> >> I think the main difference between:
> >>
> >> (clobber (mem:BLK ?))
> >>
> >> and
> >>
> >> (set (mem:BLK ?) (unspec:BLK ?))
> >>
> >> is that the latter must happen for correctness (unless something
> >> that understands the unspec proves otherwise) whereas a clobber
> >> can validly be dropped. So for something like stack_tie, a set
> >> seems more correct than a clobber.
> >
> > How can a clobber be validly dropped? For the case of stack
> > memory if there's no stack use after it it could be elided
> > and I suppose the clobber itself can be moved. But then
> > the function return is a stack use as well.
> >
> > Btw, with the same reason the (set (mem:...)) could be removed, no?
> > Or is the (unspec:) SET_SRC having implicit side-effects that
> > prevents the removal (so rs6000 could have its stack_tie removed)?
> >
> > That said, I fail to see how a clobber is special here.
>
> Clobbers are for side-effects. They don't start a def-use chain.
> E.g. any use after a full clobber is an uninitialised read rather
> than a read of the clobber ?result?.
I see. So
(parallel
(unspec stack_tie)
(clobber (mem:BLK ...)))
then? I suppose it needs to be an unspec_volatile? It feels like
the stack_ties are a delicate hack preventing enough but not too
much optimization ...
> In contrast, a set of memory with an unspec source is in dataflow terms
> the same as a set of memory with a specified source. (some unspecs
> actually have well-defined values, it's just that only the target code
> knows what those well-defined value are.)
>
> So a set of memory could only be removed if DSE proves that there are no
> reads of the set bytes before the next set(s) to the same bytes of memory.
> And memory is always live.
>
> Thanks,
> Richard
>
>
--
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg,
Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman;
HRB 36809 (AG Nuernberg)
next prev parent reply other threads:[~2023-06-14 9:52 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-13 12:23 Jiufu Guo
2023-06-13 12:48 ` Xi Ruoyao
2023-06-14 1:55 ` Jiufu Guo
2023-06-14 9:18 ` Xi Ruoyao
2023-06-14 15:05 ` Segher Boessenkool
2023-06-15 7:59 ` Jiufu Guo
2023-06-13 18:33 ` Segher Boessenkool
2023-06-14 4:06 ` Jiufu Guo
2023-06-14 7:59 ` Richard Biener
2023-06-14 9:04 ` Richard Sandiford
2023-06-14 9:22 ` Richard Biener
2023-06-14 9:43 ` Richard Sandiford
2023-06-14 9:52 ` Richard Biener [this message]
2023-06-14 10:02 ` Richard Sandiford
2023-06-14 16:08 ` Segher Boessenkool
2023-06-14 16:32 ` Segher Boessenkool
2023-06-14 9:29 ` Jiufu Guo
2023-06-14 16:38 ` Segher Boessenkool
2023-06-14 9:26 ` Jiufu Guo
2023-06-14 15:45 ` Segher Boessenkool
2023-06-14 15:38 ` Segher Boessenkool
2023-06-14 16:25 ` Richard Biener
2023-06-14 17:03 ` Segher Boessenkool
2023-06-14 15:15 ` Segher Boessenkool
2023-06-15 7:00 ` Jiufu Guo
2023-06-15 16:30 ` Segher Boessenkool
2023-06-16 2:24 ` Jiufu Guo
-- strict thread matches above, loose matches on Subject: below --
2023-06-12 13:19 Jiufu Guo
2023-06-13 0:24 ` David Edelsohn
2023-06-13 2:15 ` Jiufu Guo
2023-06-13 18:14 ` Segher Boessenkool
2023-06-13 18:59 ` David Edelsohn
2023-06-14 3:00 ` Jiufu Guo
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=nycvar.YFH.7.77.849.2306140950020.4723@jbgna.fhfr.qr \
--to=rguenther@suse.de \
--cc=bergner@linux.ibm.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=guojiufu@linux.ibm.com \
--cc=jeffreyalaw@gmail.com \
--cc=linkw@gcc.gnu.org \
--cc=richard.sandiford@arm.com \
--cc=segher@kernel.crashing.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).