public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hubicka at kam dot mff.cuni.cz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/102982] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0)
Date: Thu, 28 Oct 2021 12:14:18 +0000	[thread overview]
Message-ID: <bug-102982-4-y8YqwEJCPf@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102982-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from hubicka at kam dot mff.cuni.cz ---
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102982
> 
> Richard Biener <rguenth at gcc dot gnu.org> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>              Status|UNCONFIRMED                 |NEW
>            Keywords|                            |missed-optimization
>    Target Milestone|---                         |12.0
>      Ever confirmed|0                           |1
>                  CC|                            |hubicka at gcc dot gnu.org,
>                    |                            |jamborm at gcc dot gnu.org,
>                    |                            |marxin at gcc dot gnu.org
>    Last reconfirmed|                            |2021-10-28
>           Component|tree-optimization           |ipa
> 
> --- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
> I'd say that's indeed "unfortunate".  The main missing optimization though is
> treating
> 
>   c[0][0][0] = 0;
> 
> as a "store" when trying to make 'c' constant, not realizing it stores the
> same value as the static initializer (after making it readonly we'd have to
> elide all such stores though).  That would fix the testcase as to what
> is likely the desired trigger of the foo() call removal.
> 
> Honza/Martin?

That is probably not too hard to pattern match.  One needs a flag in
ipa-ref marking a fact that the store is constant 0 and at IPA time
ignore it for read/write analysis.  One catch is that once it becomes
readonly we should optimize out all stores and if we want to play well
with -disable-tree-XYZ we will want specific transform pass for that.

Also if ipa-prop was extended to handle stores/loads to static variables
as "fake arguments" of functions, perhaps we could get this more
systematic.

Honza

  parent reply	other threads:[~2021-10-28 12:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-28  9:47 [Bug tree-optimization/102982] New: " theodort at inf dot ethz.ch
2021-10-28  9:48 ` [Bug tree-optimization/102982] " theodort at inf dot ethz.ch
2021-10-28  9:55 ` pinskia at gcc dot gnu.org
2021-10-28 11:42 ` [Bug ipa/102982] " rguenth at gcc dot gnu.org
2021-10-28 12:14 ` hubicka at kam dot mff.cuni.cz [this message]
2021-10-28 12:27 ` rguenth at gcc dot gnu.org
2021-10-28 12:34   ` Jan Hubicka
2021-10-28 12:34 ` hubicka at kam dot mff.cuni.cz
2022-05-06  8:31 ` [Bug ipa/102982] [12/13 " jakub at gcc dot gnu.org
2022-07-26 13:10 ` rguenth at gcc dot gnu.org
2023-05-08 12:23 ` [Bug ipa/102982] [12/13/14 " 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-102982-4-y8YqwEJCPf@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).