From 855ce4cda1a374eb1ce4a24fcde65d4c3d111bcd Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 17 Nov 2020 09:35:12 +0100 Subject: [PATCH] guality: Workaround for guality/pr59776.c testcase 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-17 Jakub Jelinek * gcc.dg/guality/pr59776.c (foo): Use noipa attribute instead of noinline, noclone. --- gcc/testsuite/gcc.dg/guality/pr59776.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.dg/guality/pr59776.c b/gcc/testsuite/gcc.dg/guality/pr59776.c index 6c1c8165b70..7c95a9f9416 100644 --- a/gcc/testsuite/gcc.dg/guality/pr59776.c +++ b/gcc/testsuite/gcc.dg/guality/pr59776.c @@ -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" } } */ -- 2.30.2