public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/103168] Value numbering for PRE of pure functions can be improved
Date: Thu, 18 Nov 2021 09:13:09 +0000	[thread overview]
Message-ID: <bug-103168-4-S9AU4eVidM@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103168-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Jan Hubicka from comment #3)
> This is simple (and fairly common) case we don't optimize
> struct a {
>         int a;
>         static __attribute__ ((noinline))
>         int ret (int v) {return v;}
> 
>         __attribute__ ((noinline))
>         int inca () {return a++;}
> };
> int
> test()
> {
>         struct a av;
>         av.a=1;
>         int val = av.ret (0) + av.inca();
>         av.a=2;
>         return val + av.ret(0) + av.inca();
> }
> 
> what ret is const however becaue it is in COMDAT group we only detect it as
> pure which makes GVN to give up on proving that its value did not change
> over av.a=2 store.  We could easily work this out from modref summary (which
> says that function makes no memory load)

This case is a bit different since it just exposes we do not perform any
sort of alias walking for calls in VN.  In fact even with modref we'd need
to perform multiple walks with all stored "pieces" ao_refs.  At least that
should be doable though.

If you can provide a cut&paste place to walk & create those ao_refs I could
see to cook up the relevant VN bits.  But for next stage1 of course.

  parent reply	other threads:[~2021-11-18  9:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-10 11:15 [Bug tree-optimization/103168] New: Value numbering " hubicka at gcc dot gnu.org
2021-11-10 11:16 ` [Bug tree-optimization/103168] " hubicka at gcc dot gnu.org
2021-11-11  9:12 ` [Bug tree-optimization/103168] Value numbering for PRE " rguenth at gcc dot gnu.org
2021-11-17 20:28 ` hubicka at gcc dot gnu.org
2021-11-18  9:13 ` rguenth at gcc dot gnu.org [this message]
2021-11-18  9:39 ` hubicka at kam dot mff.cuni.cz
2021-11-18  9:40 ` hubicka at kam dot mff.cuni.cz
2021-11-19 14:21 ` [Bug tree-optimization/103168] [9/10/11/12 Regression] " hubicka at gcc dot gnu.org
2021-11-22 12:54 ` [Bug tree-optimization/103168] " rguenth at gcc dot gnu.org
2021-11-22 13:07 ` hubicka at kam dot mff.cuni.cz
2021-11-22 14:19 ` rguenth at gcc dot gnu.org
2021-11-22 14:24 ` rguenth at gcc dot gnu.org
2021-11-22 15:14 ` hubicka at kam dot mff.cuni.cz
2021-11-22 23:07 ` hubicka at gcc dot gnu.org
2021-11-23  0:26   ` Jan Hubicka
2021-11-23  7:26   ` Jan Hubicka
2021-11-23  0:26 ` hubicka at kam dot mff.cuni.cz
2021-11-23  7:26 ` hubicka at kam dot mff.cuni.cz
2021-11-23  7:43 ` rguenth at gcc dot gnu.org
2021-11-23  7:49 ` hubicka at gcc dot gnu.org
2021-11-24 11:40 ` cvs-commit at gcc dot gnu.org
2021-11-24 12:06 ` rguenth 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-103168-4-S9AU4eVidM@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).