public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] guality: Workaround for guality/pr59776.c testcase
@ 2020-11-16 21:30 Jakub Jelinek
  2020-11-17  7:31 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2020-11-16 21:30 UTC (permalink / raw)
  To: Jan Hubicka, Richard Biener, Alexandre Oliva; +Cc: gcc-patches

Hi!

The test has been added 3 years before noipa attribute has been introduced,
but already at that point I wanted to avoid IPA opts getting into way,
most of the foo function is optimized away and the debug info just points
to the caller\s var.  With the recent modref/aliasing changes the caller's
store to the variable whose address it is passing to the function is
optimized away too.

I think we should just use noipa to avoid this, though perhaps longer term
we should think about some debug info improvements how to deal with that.

The caller had before dse1:
  # DEBUG BEGIN_STMT
  x.f = 5.0e+0;
  x.g = 6.0e+0;
  # DEBUG BEGIN_STMT
  foo (&x);
  # DEBUG BEGIN_STMT
  x ={v} {CLOBBER};
and the x.f and x.g stores are optimized away.  If we had a way to pretend
the memory contains those values anyway...

Tested on x86_64-linux, fixes the guality regressions
+FAIL: gcc.dg/guality/pr59776.c   -O1  -DPREVENT_OPTIMIZATION  line pr59776.c:17 s1.f == 5.0
+FAIL: gcc.dg/guality/pr59776.c   -O1  -DPREVENT_OPTIMIZATION  line pr59776.c:17 s1.g == 6.0
+FAIL: gcc.dg/guality/pr59776.c   -O1  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s1.f == 5.0
+FAIL: gcc.dg/guality/pr59776.c   -O1  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s1.g == 6.0
+FAIL: gcc.dg/guality/pr59776.c   -O1  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s2.f == 5.0
+FAIL: gcc.dg/guality/pr59776.c   -O2  -DPREVENT_OPTIMIZATION  line pr59776.c:17 s1.f == 5.0
+FAIL: gcc.dg/guality/pr59776.c   -O2  -DPREVENT_OPTIMIZATION  line pr59776.c:17 s1.g == 6.0
+FAIL: gcc.dg/guality/pr59776.c   -O2  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s1.f == 5.0
+FAIL: gcc.dg/guality/pr59776.c   -O2  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s1.g == 6.0
+FAIL: gcc.dg/guality/pr59776.c   -O2  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s2.f == 5.0
+FAIL: gcc.dg/guality/pr59776.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none  -DPREVENT_OPTIMIZATION line pr59776.c:17 s1.f == 5.0
+FAIL: gcc.dg/guality/pr59776.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none  -DPREVENT_OPTIMIZATION line pr59776.c:17 s1.g == 6.0
+FAIL: gcc.dg/guality/pr59776.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none  -DPREVENT_OPTIMIZATION line pr59776.c:20 s1.f == 5.0
+FAIL: gcc.dg/guality/pr59776.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none  -DPREVENT_OPTIMIZATION line pr59776.c:20 s1.g == 6.0
+FAIL: gcc.dg/guality/pr59776.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none  -DPREVENT_OPTIMIZATION line pr59776.c:20 s2.f == 5.0
+FAIL: gcc.dg/guality/pr59776.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line pr59776.c:17 s1.f == 5.0
+FAIL: gcc.dg/guality/pr59776.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line pr59776.c:17 s1.g == 6.0
+FAIL: gcc.dg/guality/pr59776.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line pr59776.c:20 s1.f == 5.0
+FAIL: gcc.dg/guality/pr59776.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line pr59776.c:20 s1.g == 6.0
+FAIL: gcc.dg/guality/pr59776.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line pr59776.c:20 s2.f == 5.0
+FAIL: gcc.dg/guality/pr59776.c   -O3 -g  -DPREVENT_OPTIMIZATION  line pr59776.c:17 s1.f == 5.0
+FAIL: gcc.dg/guality/pr59776.c   -O3 -g  -DPREVENT_OPTIMIZATION  line pr59776.c:17 s1.g == 6.0
+FAIL: gcc.dg/guality/pr59776.c   -O3 -g  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s1.f == 5.0
+FAIL: gcc.dg/guality/pr59776.c   -O3 -g  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s1.g == 6.0
+FAIL: gcc.dg/guality/pr59776.c   -O3 -g  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s2.f == 5.0
+FAIL: gcc.dg/guality/pr59776.c   -Os  -DPREVENT_OPTIMIZATION  line pr59776.c:17 s1.f == 5.0
+FAIL: gcc.dg/guality/pr59776.c   -Os  -DPREVENT_OPTIMIZATION  line pr59776.c:17 s1.g == 6.0
+FAIL: gcc.dg/guality/pr59776.c   -Os  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s1.f == 5.0
+FAIL: gcc.dg/guality/pr59776.c   -Os  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s1.g == 6.0
+FAIL: gcc.dg/guality/pr59776.c   -Os  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s2.f == 5.0
introduced in the last 2 days.

2020-11-16  Jakub Jelinek  <jakub@redhat.com>

	* gcc.dg/guality/pr59776.c (foo): Use noipa attribute instead of
	noinline, noclone.

--- gcc/testsuite/gcc.dg/guality/pr59776.c.jj	2020-01-29 22:59:09.181316689 +0100
+++ gcc/testsuite/gcc.dg/guality/pr59776.c	2020-11-16 22:06:27.021813335 +0100
@@ -6,7 +6,7 @@
 
 struct S { float f, g; };
 
-__attribute__((noinline, noclone)) void
+__attribute__((noipa)) void
 foo (struct S *p)
 {
   struct S s1, s2;			/* { dg-final { gdb-test pr59776.c:17 "s1.f" "5.0" } } */

	Jakub


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

* Re: [PATCH] guality: Workaround for guality/pr59776.c testcase
  2020-11-16 21:30 [PATCH] guality: Workaround for guality/pr59776.c testcase Jakub Jelinek
@ 2020-11-17  7:31 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2020-11-17  7:31 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Jan Hubicka, Alexandre Oliva, gcc-patches

On Mon, 16 Nov 2020, Jakub Jelinek wrote:

> Hi!
> 
> The test has been added 3 years before noipa attribute has been introduced,
> but already at that point I wanted to avoid IPA opts getting into way,
> most of the foo function is optimized away and the debug info just points
> to the caller\s var.  With the recent modref/aliasing changes the caller's
> store to the variable whose address it is passing to the function is
> optimized away too.
> 
> I think we should just use noipa to avoid this, though perhaps longer term
> we should think about some debug info improvements how to deal with that.
> 
> The caller had before dse1:
>   # DEBUG BEGIN_STMT
>   x.f = 5.0e+0;
>   x.g = 6.0e+0;
>   # DEBUG BEGIN_STMT
>   foo (&x);
>   # DEBUG BEGIN_STMT
>   x ={v} {CLOBBER};
> and the x.f and x.g stores are optimized away.  If we had a way to pretend
> the memory contains those values anyway...

Yeah, but as Alex always said all his stuff isn't designed to fix
debug info of in-memory vars.  IIRC Richard Sandiford had some patches
to try to deal with DSE eliding those [for -Og].  I guess one of the
issues will be on the consumer side where printing x.g might give
6.0e+0 but printing *(double *)0xtheaddress will very likely not
(because the memory does _not_ contain the value).

> Tested on x86_64-linux, fixes the guality regressions

OK.

> +FAIL: gcc.dg/guality/pr59776.c   -O1  -DPREVENT_OPTIMIZATION  line pr59776.c:17 s1.f == 5.0
> +FAIL: gcc.dg/guality/pr59776.c   -O1  -DPREVENT_OPTIMIZATION  line pr59776.c:17 s1.g == 6.0
> +FAIL: gcc.dg/guality/pr59776.c   -O1  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s1.f == 5.0
> +FAIL: gcc.dg/guality/pr59776.c   -O1  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s1.g == 6.0
> +FAIL: gcc.dg/guality/pr59776.c   -O1  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s2.f == 5.0
> +FAIL: gcc.dg/guality/pr59776.c   -O2  -DPREVENT_OPTIMIZATION  line pr59776.c:17 s1.f == 5.0
> +FAIL: gcc.dg/guality/pr59776.c   -O2  -DPREVENT_OPTIMIZATION  line pr59776.c:17 s1.g == 6.0
> +FAIL: gcc.dg/guality/pr59776.c   -O2  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s1.f == 5.0
> +FAIL: gcc.dg/guality/pr59776.c   -O2  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s1.g == 6.0
> +FAIL: gcc.dg/guality/pr59776.c   -O2  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s2.f == 5.0
> +FAIL: gcc.dg/guality/pr59776.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none  -DPREVENT_OPTIMIZATION line pr59776.c:17 s1.f == 5.0
> +FAIL: gcc.dg/guality/pr59776.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none  -DPREVENT_OPTIMIZATION line pr59776.c:17 s1.g == 6.0
> +FAIL: gcc.dg/guality/pr59776.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none  -DPREVENT_OPTIMIZATION line pr59776.c:20 s1.f == 5.0
> +FAIL: gcc.dg/guality/pr59776.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none  -DPREVENT_OPTIMIZATION line pr59776.c:20 s1.g == 6.0
> +FAIL: gcc.dg/guality/pr59776.c   -O2 -flto -fno-use-linker-plugin -flto-partition=none  -DPREVENT_OPTIMIZATION line pr59776.c:20 s2.f == 5.0
> +FAIL: gcc.dg/guality/pr59776.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line pr59776.c:17 s1.f == 5.0
> +FAIL: gcc.dg/guality/pr59776.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line pr59776.c:17 s1.g == 6.0
> +FAIL: gcc.dg/guality/pr59776.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line pr59776.c:20 s1.f == 5.0
> +FAIL: gcc.dg/guality/pr59776.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line pr59776.c:20 s1.g == 6.0
> +FAIL: gcc.dg/guality/pr59776.c   -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects  -DPREVENT_OPTIMIZATION line pr59776.c:20 s2.f == 5.0
> +FAIL: gcc.dg/guality/pr59776.c   -O3 -g  -DPREVENT_OPTIMIZATION  line pr59776.c:17 s1.f == 5.0
> +FAIL: gcc.dg/guality/pr59776.c   -O3 -g  -DPREVENT_OPTIMIZATION  line pr59776.c:17 s1.g == 6.0
> +FAIL: gcc.dg/guality/pr59776.c   -O3 -g  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s1.f == 5.0
> +FAIL: gcc.dg/guality/pr59776.c   -O3 -g  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s1.g == 6.0
> +FAIL: gcc.dg/guality/pr59776.c   -O3 -g  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s2.f == 5.0
> +FAIL: gcc.dg/guality/pr59776.c   -Os  -DPREVENT_OPTIMIZATION  line pr59776.c:17 s1.f == 5.0
> +FAIL: gcc.dg/guality/pr59776.c   -Os  -DPREVENT_OPTIMIZATION  line pr59776.c:17 s1.g == 6.0
> +FAIL: gcc.dg/guality/pr59776.c   -Os  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s1.f == 5.0
> +FAIL: gcc.dg/guality/pr59776.c   -Os  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s1.g == 6.0
> +FAIL: gcc.dg/guality/pr59776.c   -Os  -DPREVENT_OPTIMIZATION  line pr59776.c:20 s2.f == 5.0
> introduced in the last 2 days.
> 
> 2020-11-16  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* gcc.dg/guality/pr59776.c (foo): Use noipa attribute instead of
> 	noinline, noclone.
> 
> --- gcc/testsuite/gcc.dg/guality/pr59776.c.jj	2020-01-29 22:59:09.181316689 +0100
> +++ gcc/testsuite/gcc.dg/guality/pr59776.c	2020-11-16 22:06:27.021813335 +0100
> @@ -6,7 +6,7 @@
>  
>  struct S { float f, g; };
>  
> -__attribute__((noinline, noclone)) void
> +__attribute__((noipa)) void
>  foo (struct S *p)
>  {
>    struct S s1, s2;			/* { dg-final { gdb-test pr59776.c:17 "s1.f" "5.0" } } */
> 
> 	Jakub
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Felix Imend

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

end of thread, other threads:[~2020-11-17  7:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-16 21:30 [PATCH] guality: Workaround for guality/pr59776.c testcase Jakub Jelinek
2020-11-17  7:31 ` 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).