public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/111444] [14 Regression] Wrong code at -O2/3/s on x86_64-gnu since r14-3226-gd073e2d75d9
Date: Tue, 30 Jan 2024 17:53:09 +0000	[thread overview]
Message-ID: <bug-111444-4-Lq6wUNFLd6@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-111444-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #2)
> Hmm, so we look for a *(int **) here, reach the toplevel vop, skipping *j =
> &e?
> That should have conflicted.

Seems we actually saw that.
walk_non_aliased_vuses calls walker (vn_reference_lookup_2) on .MEM_8 vuse,
that still returns NULL, then
3909              if (stmt_may_clobber_ref_p_1 (def_stmt, ref, tbaa_p))
3910                {
3911                  if (!translate)
3912                    break;
3913                  translate_flags disambiguate_only = TR_TRANSLATE;
3914                  res = (*translate) (ref, vuse, data, &disambiguate_only);
on the def_stmt:
# .MEM_8 = VDEF <.MEM_7(D)>
*j_1(D) = &e;
returns true from stmt_may_clobber_ref_p_1, correctly saying that *j_1(D) store
can clobber *i_1(D).
But then walk_non_aliased_vuses calls
3914                  res = (*translate) (ref, vuse, data, &disambiguate_only);
a few lines later, translate is vn_reference_lookup_3.
And vn_reference_lookup_3 calls vn_reference_lookup_2 here in:
              tree *saved_last_vuse_ptr = data->last_vuse_ptr;
              /* Do not update last_vuse_ptr in vn_reference_lookup_2.  */
              data->last_vuse_ptr = NULL;
              tree saved_vuse = vr->vuse;
              hashval_t saved_hashcode = vr->hashcode;
              void *res = vn_reference_lookup_2 (ref, gimple_vuse (def_stmt),
                                                 data);
              /* Need to restore vr->vuse and vr->hashcode.  */
              vr->vuse = saved_vuse;
              vr->hashcode = saved_hashcode;
              data->last_vuse_ptr = saved_last_vuse_ptr;
and def_stmt here is still the *j_1(D) = &e; statement, the problem is that
gimple_vuse (def_stmt) in that case is .MEM_7(D), so it triggers the r14-3226
if (SSA_NAME_IS_DEFAULT_DEF (vuse)) stuff at that point.  So, do we need to
somehow
arrange for the if (SSA_NAME_IS_DEFAULT_DEF (vuse)) code to be done solely when
vn_reference_lookup_2 is called directly from walk_non_aliased_vuses and not
when
called from vn_reference_lookup_3?

  parent reply	other threads:[~2024-01-30 17:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-17 13:09 [Bug tree-optimization/111444] New: " shaohua.li at inf dot ethz.ch
2023-09-17 16:19 ` [Bug tree-optimization/111444] [14 Regression] " pinskia at gcc dot gnu.org
2023-09-18  9:14 ` [Bug ipa/111444] " rguenth at gcc dot gnu.org
2024-01-30 17:20 ` jakub at gcc dot gnu.org
2024-01-30 17:53 ` jakub at gcc dot gnu.org [this message]
2024-01-30 18:00 ` jakub at gcc dot gnu.org
2024-01-30 18:09 ` jakub at gcc dot gnu.org
2024-01-31  7:37 ` rguenth at gcc dot gnu.org
2024-01-31  9:48 ` rguenth at gcc dot gnu.org
2024-01-31 10:55 ` rguenth at gcc dot gnu.org
2024-01-31 11:31 ` rguenth at gcc dot gnu.org
2024-01-31 12:49 ` cvs-commit at gcc dot gnu.org
2024-01-31 12:49 ` 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-111444-4-Lq6wUNFLd6@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).