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/107107] [10/11/12/13 Regression] Wrong codegen from TBAA when stores to distinct same-mode types are collapsed?
Date: Thu, 06 Oct 2022 09:22:18 +0000	[thread overview]
Message-ID: <bug-107107-4-tL6YLI8x0q@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107107-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue is how we value-number for tail-merging.  We do

Processing block 1: BB4
Value numbering stmt = MEM[(long int *)_3] = 2;
RHS 2 simplified to 2
No store match
Value numbering store MEM[(long int *)_3] to 2
Setting value number of .MEM_12 to .MEM_12 (changed)
marking outgoing edge 4 -> 5 executable
Processing block 2: BB3
Value numbering stmt = *_3 = 2;
RHS 2 simplified to 2
Setting value number of .MEM_11 to .MEM_12 (changed)
marking outgoing edge 3 -> 5 executable
Processing block 3: BB5
Value numbering stmt = .MEM_10 = PHI <.MEM_11(3), .MEM_12(4)>
Setting value number of .MEM_10 to .MEM_12 (changed)
Value numbering stmt = _9 = *p_5(D);
Setting value number of _9 to 1 (changed)

oops.  So we figure that the two stores from '2' are "redundant" which causes
us to only consider one (the wrong one) when later looking up *p_5(D).

That's

  if (!resultsame)
    {
      /* Only perform the following when being called from PRE
         which embeds tail merging.  */
      if (default_vn_walk_kind == VN_WALK)
        {
          assign = build2 (MODIFY_EXPR, TREE_TYPE (lhs), lhs, op);
          vn_reference_lookup (assign, vuse, VN_NOWALK, &vnresult, false);
          if (vnresult)
            {
              VN_INFO (vdef)->visited = true;
              return set_ssa_val_to (vdef, vnresult->result_vdef);
            }

that's a case I never understood fully (and that seems wrong).  That
visited flag set is also odd.

I'm testing a patch.

  parent reply	other threads:[~2022-10-06  9:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-30 21:34 [Bug middle-end/107107] New: " bugdal at aerifal dot cx
2022-10-01  2:25 ` [Bug middle-end/107107] " bugdal at aerifal dot cx
2022-10-01  2:59 ` pinskia at gcc dot gnu.org
2022-10-01  3:02 ` pinskia at gcc dot gnu.org
2022-10-01  3:05 ` [Bug tree-optimization/107107] [10/11/12/13 Regression] " pinskia at gcc dot gnu.org
2022-10-01  3:05 ` pinskia at gcc dot gnu.org
2022-10-01 17:08 ` amonakov at gcc dot gnu.org
2022-10-01 20:01 ` bugdal at aerifal dot cx
2022-10-06  9:02 ` rguenth at gcc dot gnu.org
2022-10-06  9:22 ` rguenth at gcc dot gnu.org [this message]
2022-10-06 10:07 ` cvs-commit at gcc dot gnu.org
2022-10-06 10:08 ` [Bug tree-optimization/107107] [10/11/12 " rguenth at gcc dot gnu.org
2022-10-17 13:10 ` cvs-commit at gcc dot gnu.org
2022-12-12 16:33 ` [Bug tree-optimization/107107] [10/11 " cvs-commit at gcc dot gnu.org
2023-01-26 13:05 ` [Bug tree-optimization/107107] [10 " cvs-commit at gcc dot gnu.org
2023-01-26 13: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-107107-4-tL6YLI8x0q@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).