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/111715] Missed optimization in FRE because of weak TBAA
Date: Mon, 09 Oct 2023 11:12:09 +0000	[thread overview]
Message-ID: <bug-111715-4-HcgZAqJKpt@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-111715-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Reduced testcase:

struct B {
   struct { int len; } l;
   long n;
};
struct A {
   struct B elts[8];
};

static void
set_len (struct B *b, int len)
{
  b->l.len = len;
}

static int
get_len (struct B *b)
{
  return b->l.len;
}

int foo (struct A *a, int i, long *q)
{
  set_len (&a->elts[i], 1);
  *q = 2;
  return get_len (&a->elts[i]);
}

with the patch we end up doing the following in FRE1.  I think the path
based disambiguation is unaffected by assigning a different alias set.

 int foo (struct A * a, int i, long int * q)
 {
   int D.2787;
-  int _9;

   <bb 2> :
   MEM <struct A> [(struct B *)a_3(D)].elts[i_4(D)].l.len = 1;
   *q_7(D) = 2;
-  _9 = MEM <struct A> [(struct B *)a_3(D)].elts[i_4(D)].l.len;
-  return _9;
+  return 1;

  parent reply	other threads:[~2023-10-09 11:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-06 15:06 [Bug tree-optimization/111715] New: " rguenth at gcc dot gnu.org
2023-10-06 15:07 ` [Bug tree-optimization/111715] " rguenth at gcc dot gnu.org
2023-10-06 15:09 ` rguenth at gcc dot gnu.org
2023-10-09 11:12 ` rguenth at gcc dot gnu.org [this message]
2023-10-09 13:20 ` cvs-commit at gcc dot gnu.org
2023-10-09 13:20 ` rguenth at gcc dot gnu.org
2023-10-09 21:34 ` sjames at gcc dot gnu.org
2023-10-10  6:46 ` rguenth at gcc dot gnu.org
2023-10-10  6:58 ` sjames 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-111715-4-HcgZAqJKpt@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).