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  <ja...@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 <rguent...@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Felix Imend

Reply via email to