public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* TBAA bug?
@ 2021-07-25 11:58 Uecker, Martin
  2021-07-27  8:02 ` Richard Biener
  2021-07-27  8:05 ` Richard Biener
  0 siblings, 2 replies; 4+ messages in thread
From: Uecker, Martin @ 2021-07-25 11:58 UTC (permalink / raw)
  To: richard.guenther; +Cc: gcc



Hi Richard,

here is another case where it seems that TBAA goes
wrong. Since this is not in a loop, it seems this
is something else than what we discussed. Is
this a known issue?

Best,
Martin


#include <stdio.h>
#include <stdlib.h>

union u {
  long x;
  long long y;
};

__attribute__((noinline,noclone))
long test(long *px, long long *py, union u *pu)
{
  *px = 0;
  *py = 1;

  long xy = pu->y;
  pu->x = xy;

  return *px;
}

int main(void)
{
  union u u;
  printf("%ld\n", test(&u.x, &u.y, &u));
}

https://godbolt.org/z/a9drezEza


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: TBAA bug?
  2021-07-25 11:58 TBAA bug? Uecker, Martin
@ 2021-07-27  8:02 ` Richard Biener
  2021-07-27  8:05 ` Richard Biener
  1 sibling, 0 replies; 4+ messages in thread
From: Richard Biener @ 2021-07-27  8:02 UTC (permalink / raw)
  To: Uecker, Martin; +Cc: gcc

On Sun, Jul 25, 2021 at 1:58 PM Uecker, Martin
<Martin.Uecker@med.uni-goettingen.de> wrote:
>
>
>
> Hi Richard,
>
> here is another case where it seems that TBAA goes
> wrong. Since this is not in a loop, it seems this
> is something else than what we discussed. Is
> this a known issue?
>
> Best,
> Martin
>
>
> #include <stdio.h>
> #include <stdlib.h>
>
> union u {
>   long x;
>   long long y;
> };
>
> __attribute__((noinline,noclone))
> long test(long *px, long long *py, union u *pu)
> {
>   *px = 0;
>   *py = 1;
>
>   long xy = pu->y;
>   pu->x = xy;
>
>   return *px;
> }
>
> int main(void)
> {
>   union u u;
>   printf("%ld\n", test(&u.x, &u.y, &u));
> }
>
> https://godbolt.org/z/a9drezEza
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: TBAA bug?
  2021-07-25 11:58 TBAA bug? Uecker, Martin
  2021-07-27  8:02 ` Richard Biener
@ 2021-07-27  8:05 ` Richard Biener
  2021-07-27 12:08   ` Richard Biener
  1 sibling, 1 reply; 4+ messages in thread
From: Richard Biener @ 2021-07-27  8:05 UTC (permalink / raw)
  To: Uecker, Martin; +Cc: gcc

On Sun, Jul 25, 2021 at 1:58 PM Uecker, Martin
<Martin.Uecker@med.uni-goettingen.de> wrote:
>
>
>
> Hi Richard,
>
> here is another case where it seems that TBAA goes
> wrong. Since this is not in a loop, it seems this
> is something else than what we discussed. Is
> this a known issue?

No, it's not known and it is a bug.  It seems to be
related to doing

Value numbering stmt = pu_6(D)->x = xy_7;
Store matched earlier value, value numbering store vdefs to matching vuses.
Setting value number of .MEM_8 to .MEM_5 (changed)

I'm looking into it.

Richard.

> Best,
> Martin
>
>
> #include <stdio.h>
> #include <stdlib.h>
>
> union u {
>   long x;
>   long long y;
> };
>
> __attribute__((noinline,noclone))
> long test(long *px, long long *py, union u *pu)
> {
>   *px = 0;
>   *py = 1;
>
>   long xy = pu->y;
>   pu->x = xy;
>
>   return *px;
> }
>
> int main(void)
> {
>   union u u;
>   printf("%ld\n", test(&u.x, &u.y, &u));
> }
>
> https://godbolt.org/z/a9drezEza
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: TBAA bug?
  2021-07-27  8:05 ` Richard Biener
@ 2021-07-27 12:08   ` Richard Biener
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Biener @ 2021-07-27 12:08 UTC (permalink / raw)
  To: Uecker, Martin; +Cc: gcc

On Tue, Jul 27, 2021 at 10:05 AM Richard Biener
<richard.guenther@gmail.com> wrote:
>
> On Sun, Jul 25, 2021 at 1:58 PM Uecker, Martin
> <Martin.Uecker@med.uni-goettingen.de> wrote:
> >
> >
> >
> > Hi Richard,
> >
> > here is another case where it seems that TBAA goes
> > wrong. Since this is not in a loop, it seems this
> > is something else than what we discussed. Is
> > this a known issue?
>
> No, it's not known and it is a bug.  It seems to be
> related to doing
>
> Value numbering stmt = pu_6(D)->x = xy_7;
> Store matched earlier value, value numbering store vdefs to matching vuses.
> Setting value number of .MEM_8 to .MEM_5 (changed)
>
> I'm looking into it.

I've filed PR101641

>
> Richard.
>
> > Best,
> > Martin
> >
> >
> > #include <stdio.h>
> > #include <stdlib.h>
> >
> > union u {
> >   long x;
> >   long long y;
> > };
> >
> > __attribute__((noinline,noclone))
> > long test(long *px, long long *py, union u *pu)
> > {
> >   *px = 0;
> >   *py = 1;
> >
> >   long xy = pu->y;
> >   pu->x = xy;
> >
> >   return *px;
> > }
> >
> > int main(void)
> > {
> >   union u u;
> >   printf("%ld\n", test(&u.x, &u.y, &u));
> > }
> >
> > https://godbolt.org/z/a9drezEza
> >

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-27 12:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-25 11:58 TBAA bug? Uecker, Martin
2021-07-27  8:02 ` Richard Biener
2021-07-27  8:05 ` Richard Biener
2021-07-27 12:08   ` Richard Biener

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).