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/99793] missed optimization for dead code elimination at -Os, -O2 and -O3 (vs. -O1)
Date: Mon, 29 Mar 2021 07:35:56 +0000	[thread overview]
Message-ID: <bug-99793-4-yLta0IRjhG@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99793-4@http.gcc.gnu.org/bugzilla/>

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
            Version|unknown                     |11.0
   Last reconfirmed|                            |2021-03-29
           Keywords|                            |missed-optimization

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
So the difference is -fstrict-aliasing which causes us to not elide the
redundant store to 'd' which in turn makes us fail to promote 'd' read-only:

 Value numbering stmt = d = d.2_2;
-Store matched earlier value, value numbering store vdefs to matching vuses.
-Setting value number of .MEM_9 to .MEM_8 (changed)
-Deleted redundant store d = d.2_2;
+No store match
+Value numbering store d to d.2_2
+Setting value number of .MEM_9 to .MEM_9 (changed)

and the issue is that we "optimize" part of the walking with recording
last_vuse and using that vuse to insert the preceeding load into the
hashtables but since the walking is different for redundant store
detection (no TBAA), it cannot walk that far (beyond the non-TBAA
aliasing store to *b) and thus it cannot find the hashtable entry of
the d.2_2 = d load.  The last-vuse trick is poor-mans "PRE" - I do remember
experimenting with inserting both last and original vuse exprs but I do not
remember the outcome.

  reply	other threads:[~2021-03-29  7:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-26 15:04 [Bug tree-optimization/99793] New: " zhendong.su at inf dot ethz.ch
2021-03-29  7:35 ` rguenth at gcc dot gnu.org [this message]
2021-09-28 10:50 ` [Bug tree-optimization/99793] " cvs-commit at gcc dot gnu.org
2021-09-28 10:50 ` 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-99793-4-yLta0IRjhG@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).