diff options
author | Rong Xu <xur@google.com> | 2014-07-21 16:47:22 -0700 |
---|---|---|
committer | Rong Xu <xur@google.com> | 2014-07-29 15:31:03 -0700 |
commit | 38a8aecfb882072900434499696b5c32a2274515 (patch) | |
tree | 2aac97f0ae24b03cd98c1a06e989c031c173f889 /gcc-4.9/gcc/testsuite/gcc.dg | |
parent | c231900e5dcc14d8296bd9f62b45997a49d4d5e7 (diff) | |
download | toolchain_gcc-38a8aecfb882072900434499696b5c32a2274515.tar.gz toolchain_gcc-38a8aecfb882072900434499696b5c32a2274515.tar.bz2 toolchain_gcc-38a8aecfb882072900434499696b5c32a2274515.zip |
[4.9] Switch gcc-4.9 to use google/gcc-4_9 branch.
This source drop uses svn version r212828 of google/gcc-4.9 branch.
We also cherry-picked r213062, r213063 and r213064 to fix windows
build issues.
All gcc-4.9 patches before July 3rd are ported to google/gcc-4.9.
The following prior commits has not been merged to google branch yet.
(They are included in this commit).
e7af147f979e657fe2df00808e5b4319b0e088c6,
baf87df3cb2683649ba7e9872362a7e721117c23, and
c231900e5dcc14d8296bd9f62b45997a49d4d5e7.
Change-Id: I4bea3ea470387ff751c2be4cb0d4a12059b9299b
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg')
108 files changed, 2226 insertions, 58 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/Wshadow-compatible-local-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/Wshadow-compatible-local-1.c new file mode 100644 index 000000000..cb21be9ae --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/Wshadow-compatible-local-1.c @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-options "-Wshadow-compatible-local" } */ + +struct Bar { +}; + +struct Bar bar; /* { dg-bogus "shadowed declaration" } */ + +int val; /* { dg-bogus "shadowed declaration" } */ + +int func1(int x) { /* { dg-bogus "shadowed declaration" } */ + int val; /* { dg-bogus "shadows a global" } */ + val = x; + return val; +} + +int func2(int i) { + int a = 3; /* { dg-warning "shadowed declaration" } */ + int j; /* { dg-warning "shadowed declaration" } */ + + for (j = 0; j < i; ++j) { + int a = j; /* { dg-warning "shadows a previous local" } */ + int j = a + 1; /* { dg-warning "shadows a previous local" } */ + func1(j); + } + + return a; +} + +void func4() { + struct Bar bar; /* { dg-bogus "shadowed declaration" } */ + if (val) { + int bar; /* { dg-bogus "shadows a previous local" } */ + func1(bar); + } +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/Wshadow-local-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/Wshadow-local-1.c new file mode 100644 index 000000000..b21661ef8 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/Wshadow-local-1.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-Wshadow-local" } */ + +int decl1; /* should not warn */ +void foo (double decl1) /* should not warn */ +{ +} + +void foo2 (int d) /* { dg-warning "shadowed declaration" } */ +{ + { + double d; /* { dg-warning "shadows a parameter" } */ + } +} + +void foo3 () +{ + int local; /* { dg-warning "shadowed declaration" } */ + { + int local; /* { dg-warning "shadows a previous local" } */ + } +} +/* { dg-do compile } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/Wshadow-local-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/Wshadow-local-2.c new file mode 100644 index 000000000..9d52fac6f --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/Wshadow-local-2.c @@ -0,0 +1,49 @@ +/* { dg-do compile } */ +/* { dg-options "-Wshadow-local" } */ + +struct Bar { +}; + +struct Bar bar; /* { dg-bogus "shadowed declaration" } */ + +int val; /* { dg-bogus "shadowed declaration" } */ + +int func1(int x) { /* { dg-bogus "shadowed declaration" } */ + int val; /* { dg-bogus "shadows a global" } */ + val = x; + return val; +} + +int func2(int i) { + int a = 3; /* { dg-warning "shadowed declaration" } */ + int j; /* { dg-warning "shadowed declaration" } */ + + for (j = 0; j < i; ++j) { + int a = j; /* { dg-warning "shadows a previous local" } */ + int j = a + 1; /* { dg-warning "shadows a previous local" } */ + func1(j); + } + + return a; +} + +int func3() { + int bar; /* { dg-bogus "shadows a global" } */ + float func1 = 0.3; /* { dg-bogus "shadows a global" } */ + + if (func1 > 1) + bar = 2; + else + bar = 1; + return bar; +} + +void func4() { + struct Bar bar; /* { dg-warning "shadowed declaration" } */ + if (val) { + int bar; /* { dg-warning "shadows a previous local" } */ + func1(bar); + } +} + +/* { dg-bogus "shadows a global" "" { target *-*-* } 42 } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/Wshadow-local-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/Wshadow-local-3.c new file mode 100644 index 000000000..429df37f5 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/Wshadow-local-3.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-Wno-shadow" } */ + +void func() { + int i; + { + int i; /* should not warn */ + } +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/outer-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/outer-1.c index a9d2185f0..2e4faf44b 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/outer-1.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/outer-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ void abort (void); diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/outer-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/outer-3.c index c6e0adbff..755b9da4d 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/outer-3.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/outer-3.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ void abort (void); diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/outer-4.c b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/outer-4.c index d60023f5d..0feac6897 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/outer-4.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/outer-4.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ void abort (void); diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/outer-5.c b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/outer-5.c index fa8029326..f6cd97093 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/outer-5.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/outer-5.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ void abort (void); diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/parallelization-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/parallelization-1.c index de2a0f3cc..fe77a92e8 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/parallelization-1.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/parallelization-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ void abort (void); diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-1.c index 8018a558c..9bb1b5761 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-1.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ #include <stdarg.h> #include <stdlib.h> diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-1char.c b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-1char.c index 76645c850..832202008 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-1char.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-1char.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ #include <stdarg.h> #include <stdlib.h> diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-1short.c b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-1short.c index 526f17009..5a2efa871 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-1short.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-1short.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ #include <stdarg.h> #include <stdlib.h> diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-2.c index e0abb265b..8c9fb03a0 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-2.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-2.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ #include <stdarg.h> #include <stdlib.h> diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-2char.c b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-2char.c index ada1275f9..cff542511 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-2char.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-2char.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ #include <stdarg.h> #include <stdlib.h> diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-2short.c b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-2short.c index 3363c68f4..5ee5f014d 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-2short.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-2short.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ #include <stdarg.h> #include <stdlib.h> diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-3.c index 6bc204711..c9ec27b89 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-3.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-3.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ #include <stdarg.h> #include <stdlib.h> diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-6.c b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-6.c index fface8fed..5d495e34a 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-6.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-6.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ #include <stdarg.h> #include <stdlib.h> diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-7.c b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-7.c index f66069e56..72a36ad9b 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-7.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-7.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ #include <stdlib.h> diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-8.c b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-8.c index 4a416df23..662ff44cb 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-8.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-8.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ #include <stdlib.h> diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-9.c b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-9.c index 2c1677ce5..c738f2300 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-9.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/autopar/reduc-9.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized" } */ #include <stdlib.h> diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/debug/dwarf2/mlt1.c b/gcc-4.9/gcc/testsuite/gcc.dg/debug/dwarf2/mlt1.c new file mode 100644 index 000000000..b916e69cf --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/debug/dwarf2/mlt1.c @@ -0,0 +1,32 @@ +/* Test that -g1 includes line tables and inlined subroutine entries, + and excludes types and variables. */ +/* Origin: Cary Coutant <ccoutant@google.com> */ +/* { dg-do compile } */ +/* { dg-options "-O2 -gdwarf-2 -dA -g1" } */ +/* { dg-final { scan-assembler "DW_AT_stmt_list" } } */ +/* { dg-final { scan-assembler "DW_TAG_subprogram" } } */ +/* { dg-final { scan-assembler "DW_TAG_inlined_subroutine" } } */ +/* { dg-final { scan-assembler-not "DW_TAG_variable" } } */ +/* { dg-final { scan-assembler-not "DW_TAG_formal_parameter" } } */ +/* { dg-final { scan-assembler-not "DW_TAG_base_type" } } */ + +static inline __attribute__((always_inline)) int +a(int i, int j) +{ + return (i << 5) + j; +} + +int +b(int i, int j) +{ + return (i >> 5) + (j << 27); +} + +int +c(int i, int j) +{ + int r = a(i, j); + r = b(r, i); + r = b(r, j); + return r; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/debug/dwarf2/mlt2.c b/gcc-4.9/gcc/testsuite/gcc.dg/debug/dwarf2/mlt2.c new file mode 100644 index 000000000..2fd5b0f22 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/debug/dwarf2/mlt2.c @@ -0,0 +1,31 @@ +/* Test that -g overrides -g1. */ +/* Origin: Cary Coutant <ccoutant@google.com> */ +/* { dg-do compile } */ +/* { dg-options "-O2 -gdwarf-2 -dA -g1 -g" } */ +/* { dg-final { scan-assembler "DW_AT_stmt_list" } } */ +/* { dg-final { scan-assembler "DW_TAG_subprogram" } } */ +/* { dg-final { scan-assembler "DW_TAG_inlined_subroutine" } } */ +/* { dg-final { scan-assembler "DW_TAG_variable" } } */ +/* { dg-final { scan-assembler "DW_TAG_formal_parameter" } } */ +/* { dg-final { scan-assembler "DW_TAG_base_type" } } */ + +static inline __attribute__((always_inline)) int +a(int i, int j) +{ + return (i << 5) + j; +} + +int +b(int i, int j) +{ + return (i >> 5) + (j << 27); +} + +int +c(int i, int j) +{ + int r = a(i, j); + r = b(r, i); + r = b(r, j); + return r; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/fstack-protector-strong.c b/gcc-4.9/gcc/testsuite/gcc.dg/fstack-protector-strong.c index 7c232fff2..5a5cf98a7 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/fstack-protector-strong.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/fstack-protector-strong.c @@ -1,9 +1,10 @@ /* Test that stack protection is done on chosen functions. */ -/* { dg-do compile { target i?86-*-* x86_64-*-* rs6000-*-* s390x-*-* } } */ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ /* { dg-options "-O2 -fstack-protector-strong" } */ #include<string.h> +#include<stdlib.h> extern int g0; extern int* pg0; @@ -109,7 +110,7 @@ foo8 () int foo9 () { - char* p = __builtin_alloca (100); + char* p = alloca (100); return goo ((int *)(p + 50)); } diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/graphite/pr55022.c b/gcc-4.9/gcc/testsuite/gcc.dg/graphite/pr55022.c new file mode 100644 index 000000000..c631c0e23 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/graphite/pr55022.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fgraphite-identity" } */ + +extern void abort (void); + +void __attribute__((noinline,noclone)) +f(int *limit, int minLen, int maxLen) +{ + int i; + + for (i = minLen; i <= maxLen; i++) { + limit[i] = i; + } +} + +int main() +{ + int limit[256], i; + f (limit, 0, 255); + for (i = 0; i < 256; ++i) + { + if (limit[i] != i) + abort (); + __asm__ volatile ("" : : : "memory"); + } + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/graphite/pr59817-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/graphite/pr59817-1.c new file mode 100644 index 000000000..175fa16fd --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/graphite/pr59817-1.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -floop-interchange" } */ + +int kd; + +void +n2(void) +{ + static int so; + static short int i5; + int wj; + int *il; + int *nk = &so; + for (wj = 0; wj < 2; ++wj) + *nk = ((i5 += *il) || kd ); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/graphite/pr59817-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/graphite/pr59817-2.c new file mode 100644 index 000000000..139500768 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/graphite/pr59817-2.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -floop-interchange" } */ + +void +xl(void) +{ + static int j3; + for (j3 = 0; j3 < 1; ++j3) { + static int f2; + static int w7; + short int b5; + int ok; + f2 = (b5 += ok) ? (w7 = 0): (w7 ? 0 : (f2 = ok)); + } +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/graphite/pr60979.c b/gcc-4.9/gcc/testsuite/gcc.dg/graphite/pr60979.c new file mode 100644 index 000000000..0004a5124 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/graphite/pr60979.c @@ -0,0 +1,37 @@ +/* { dg-options "-O -fgraphite-identity" } */ + +#include <setjmp.h> + +struct x; + +typedef struct x **(*a)(struct x *); + +struct x { + union { + struct { + union { + a *i; + } l; + int s; + } y; + } e; +}; + +jmp_buf c; + +void +b(struct x *r) +{ + int f; + static int w = 0; + volatile jmp_buf m; + f = (*(((struct x *)r)->e.y.l.i[2]((struct x *)r)))->e.y.s; + if (w++ != 0) + __builtin_memcpy((char *)m, (const char *)c, sizeof(jmp_buf)); + if (setjmp (c) == 0) { + int z; + for (z = 0; z < 0; ++z) + ; + } + d((const char *)m); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/guality/guality.exp b/gcc-4.9/gcc/testsuite/gcc.dg/guality/guality.exp index 5e714dd7d..d8e641f81 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/guality/guality.exp +++ b/gcc-4.9/gcc/testsuite/gcc.dg/guality/guality.exp @@ -1,5 +1,8 @@ # This harness is for tests that should be run at all optimisation levels. +# Disable everywhere. These tests are very flaky. +return + load_lib gcc-dg.exp load_lib gcc-gdb-test.exp diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/lto/pr60720_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/lto/pr60720_0.c new file mode 100644 index 000000000..79cef5dad --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/lto/pr60720_0.c @@ -0,0 +1,15 @@ +/* { dg-lto-do run } */ +/* { dg-extra-ld-options { -w } } */ + +/* ??? lto.exp does not allow to scan for + :1:12: warning: type of 'x' does not match original declaration + extern int x[]; + ^ + :1:5: note: previously declared here + int x; + ^ */ + +extern int x[]; +int *foo[] = { &x[0] }; + +int main() { return *foo[0]; } diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/lto/pr60720_1.c b/gcc-4.9/gcc/testsuite/gcc.dg/lto/pr60720_1.c new file mode 100644 index 000000000..6d1a0d47b --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/lto/pr60720_1.c @@ -0,0 +1 @@ +int x; diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/lto/pr60911_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/lto/pr60911_0.c new file mode 100644 index 000000000..e4820a204 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/lto/pr60911_0.c @@ -0,0 +1,21 @@ +// { dg-lto-do run } +// { dg-lto-options { { -O2 -flto -fipa-pta } } } + +int __attribute__ ((__noinline__)) f (unsigned *p, int *x) +{ + int y = *p++ & 0xfff; + *x++ = y; + *x = *p; + return y; +} + +int +main () +{ + unsigned u[2] = { 0x3aad, 0x5ad1 }; + int x[2] = { 17689, 23456 }; + + if (f (u, x) != 0xaad || x[0] != 0xaad || x[1] != 0x5ad1) + __builtin_abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/lto/pr61526_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/lto/pr61526_0.c new file mode 100644 index 000000000..6324c8c5b --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/lto/pr61526_0.c @@ -0,0 +1,6 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options { { -fPIC -flto -flto-partition=1to1 } } } */ +/* { dg-extra-ld-options { -shared } } */ + +static void *master; +void *foo () { return master; } diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/lto/pr61526_1.c b/gcc-4.9/gcc/testsuite/gcc.dg/lto/pr61526_1.c new file mode 100644 index 000000000..bb2893b73 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/lto/pr61526_1.c @@ -0,0 +1,2 @@ +extern void *master; +void *bar () { return master; } diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/plugin/selfassign.c b/gcc-4.9/gcc/testsuite/gcc.dg/plugin/selfassign.c index 041f25dce..9a0c620dd 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/plugin/selfassign.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/plugin/selfassign.c @@ -211,7 +211,7 @@ compare_and_warn (gimple stmt, tree lhs, tree rhs) /* Check and warn if STMT is a self-assign statement. */ static void -warn_self_assign (gimple stmt) +check_self_assign (gimple stmt) { tree rhs, lhs; @@ -264,7 +264,7 @@ execute_warn_self_assign (void) FOR_EACH_BB_FN (bb, cfun) { for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) - warn_self_assign (gsi_stmt (gsi)); + check_self_assign (gsi_stmt (gsi)); } return 0; diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr47793.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr47793.c index 0ee1aaee4..da6b6eab6 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/pr47793.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr47793.c @@ -1,7 +1,6 @@ /* Bug pr47793: Allow relative paths in profile-generate. */ /* { dg-do run } */ /* { dg-options "-O -fprofile-generate=./" } */ -/* { dg-require-profiling "-fprofile-generate" } */ /* { dg-final { scan-file pr47793.gcda "."} } */ int diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr53265.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr53265.c index e1ca6f521..c5ed476ed 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/pr53265.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr53265.c @@ -1,6 +1,6 @@ /* PR tree-optimization/53265 */ /* { dg-do compile } */ -/* { dg-options "-O2 -Wall" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -Wall" } */ /* { dg-require-effective-target size32plus } */ void bar (void *); @@ -155,3 +155,5 @@ fn12 (void) fn11 (1); fn11 (1); } + +/* { dg-prune-output "array subscript is above array bounds" } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr57233.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr57233.c new file mode 100644 index 000000000..58c05348b --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr57233.c @@ -0,0 +1,171 @@ +/* PR tree-optimization/57233 */ +/* { dg-do run { target { ilp32 || lp64 } } } */ +/* { dg-options "-O2" } */ + +typedef unsigned V4 __attribute__((vector_size(4 * sizeof (int)))); +typedef unsigned V8 __attribute__((vector_size(8 * sizeof (int)))); +typedef unsigned V16 __attribute__((vector_size(16 * sizeof (int)))); +V4 a, b, g; +V8 c, d, h; +V16 e, f, j; + +__attribute__((noinline)) void +f1 (void) +{ + a = (a << 2) | (a >> 30); +} + +__attribute__((noinline)) void +f2 (void) +{ + a = (a << 30) | (a >> 2); +} + +__attribute__((noinline)) void +f3 (void) +{ + a = (a << b) | (a >> (32 - b)); +} + +__attribute__((noinline, noclone)) void +f4 (int x) +{ + a = (a << x) | (a >> (32 - x)); +} + +__attribute__((noinline)) void +f5 (void) +{ + c = (c << 2) | (c >> 30); +} + +__attribute__((noinline)) void +f6 (void) +{ + c = (c << 30) | (c >> 2); +} + +__attribute__((noinline)) void +f7 (void) +{ + c = (c << d) | (c >> (32 - d)); +} + +__attribute__((noinline, noclone)) void +f8 (int x) +{ + c = (c << x) | (c >> (32 - x)); +} + +__attribute__((noinline)) void +f9 (void) +{ + e = (e << 2) | (e >> 30); +} + +__attribute__((noinline)) void +f10 (void) +{ + e = (e << 30) | (e >> 2); +} + +__attribute__((noinline)) void +f11 (void) +{ + e = (e << f) | (e >> (32 - f)); +} + +__attribute__((noinline, noclone)) void +f12 (int x) +{ + e = (e << x) | (e >> (32 - x)); +} + +unsigned +r (void) +{ + static unsigned x = 0xdeadbeefU; + static unsigned y = 0x12347654U; + static unsigned z = 0x1a2b3c4dU; + static unsigned w = 0x87654321U; + unsigned t = x ^ (x << 11); + x = y; + y = z; + z = w; + w = w ^ (w >> 19) ^ t ^ (t >> 8); + return w; +} + +void +init (unsigned int *p, int count, int mod) +{ + int i; + for (i = 0; i < count; i++) + { + unsigned int v = r (); + if (mod) + v = (v % 31) + 1; + p[i] = v; + } +} + +void +check (unsigned int *p, unsigned int *q, int count, unsigned int *s, int ss) +{ + int i; + for (i = 0; i < count; i++) + { + if (s) + ss = s[i]; + if (p[i] != ((q[i] << ss) | (q[i] >> (32 - ss)))) + __builtin_abort (); + } +} + +int +main () +{ + init ((unsigned int *) &a, 4, 0); + init ((unsigned int *) &b, 4, 1); + init ((unsigned int *) &c, 8, 0); + init ((unsigned int *) &d, 8, 1); + init ((unsigned int *) &e, 16, 0); + init ((unsigned int *) &f, 16, 1); + g = a; + h = c; + j = e; + f1 (); + f5 (); + f9 (); + check ((unsigned int *) &a, (unsigned int *) &g, 4, 0, 2); + check ((unsigned int *) &c, (unsigned int *) &h, 8, 0, 2); + check ((unsigned int *) &e, (unsigned int *) &j, 16, 0, 2); + g = a; + h = c; + j = e; + f2 (); + f6 (); + f10 (); + check ((unsigned int *) &a, (unsigned int *) &g, 4, 0, 30); + check ((unsigned int *) &c, (unsigned int *) &h, 8, 0, 30); + check ((unsigned int *) &e, (unsigned int *) &j, 16, 0, 30); + g = a; + h = c; + j = e; + f3 (); + f7 (); + f11 (); + check ((unsigned int *) &a, (unsigned int *) &g, 4, (unsigned int *) &b, 0); + check ((unsigned int *) &c, (unsigned int *) &h, 8, (unsigned int *) &d, 0); + check ((unsigned int *) &e, (unsigned int *) &j, 16, (unsigned int *) &f, 0); + g = a; + h = c; + j = e; + f4 (5); + f8 (5); + f12 (5); + check ((unsigned int *) &a, (unsigned int *) &g, 4, 0, 5); + check ((unsigned int *) &c, (unsigned int *) &h, 8, 0, 5); + check ((unsigned int *) &e, (unsigned int *) &j, 16, 0, 5); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr60844.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr60844.c new file mode 100644 index 000000000..16ed243d7 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr60844.c @@ -0,0 +1,16 @@ +/* PR tree-optimization/60844 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -g" } */ +/* { dg-additional-options "-mtune=atom" { target { i?86-*-* x86_64-*-* } } } */ + +void +foo (int *x, int y, int z) +{ + int b, c = x[0], d = x[1]; + for (b = 0; b < 1; b++) + { + int e = (y ? 1 : 0) | (d ? 2 : 0) | (z ? 1 : 0); + e |= (c ? 2 : 0) | ((1 >> b) ? 1 : 0); + x[2 + b] = e; + } +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr60866.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr60866.c new file mode 100644 index 000000000..020878d41 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr60866.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target powerpc*-*-* ia64-*-* x86_64-*-* } } */ +/* { dg-options "-O -fselective-scheduling -fno-if-conversion -fschedule-insns" } */ + +int n; + +void +foo (int w, int **dnroot, int **dn) +{ + int *child; + int *xchild = xchild; + for (; w < n; w++) + if (!dnroot) + { + dnroot = dn; + for (child = *dn; child; child = xchild) + ; + } +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr61045.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr61045.c new file mode 100644 index 000000000..1808cdc25 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr61045.c @@ -0,0 +1,12 @@ +/* { dg-do run } */ +/* { dg-options "-fstrict-overflow" } */ + +int main () +{ + int a = 0; + int b = __INT_MAX__; + int t = (a - 2) > (b - 1); + if (t != 0) + __builtin_abort(); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr61053.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr61053.c new file mode 100644 index 000000000..4fd531974 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr61053.c @@ -0,0 +1,75 @@ +/* PR c/61053 */ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-std=c11 -pedantic-errors" } */ + +_Alignas (char) char cc; +_Alignas (short int) char cs; +_Alignas (int) char ci; +_Alignas (long int) char cl; +_Alignas (long long int) char cll; +_Alignas (float) char cf; +_Alignas (double) char cd; +_Alignas (long double) char cld; + +_Alignas (char) short int sc; /* { dg-error "cannot reduce alignment" } */ +_Alignas (short int) short int ss; +_Alignas (int) short int si; +_Alignas (long int) short int sl; +_Alignas (long long int) short int sll; +_Alignas (float) short int sf; +_Alignas (double) short int sd; +_Alignas (long double) short int sld; + +_Alignas (char) int ic; /* { dg-error "cannot reduce alignment" } */ +_Alignas (short int) int is; /* { dg-error "cannot reduce alignment" } */ +_Alignas (int) int ii; +_Alignas (long int) int il; +_Alignas (long long int) int ill; +_Alignas (float) int if_; +_Alignas (double) int id; +_Alignas (long double) int ild; + +_Alignas (char) long int lic; /* { dg-error "cannot reduce alignment" } */ +_Alignas (short int) long int lis; /* { dg-error "cannot reduce alignment" } */ +_Alignas (int) long int lii; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */ +_Alignas (long int) long int lil; +_Alignas (long long int) long int lill; +_Alignas (float) long int lif; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */ +_Alignas (double) long int lid; +_Alignas (long double) long int lild; + +_Alignas (char) long long int llic; /* { dg-error "cannot reduce alignment" } */ +_Alignas (short int) long long int llis; /* { dg-error "cannot reduce alignment" } */ +_Alignas (int) long long int llii; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */ +_Alignas (long int) long long int llil; +_Alignas (long long int) long long int llill; +_Alignas (float) long long int llif; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */ +_Alignas (double) long long int llid; +_Alignas (long double) long long int llild; + +_Alignas (char) float fc; /* { dg-error "cannot reduce alignment" } */ +_Alignas (short int) float fs; /* { dg-error "cannot reduce alignment" } */ +_Alignas (int) float fi; +_Alignas (long int) float fl; +_Alignas (long long int) float fll; +_Alignas (float) float ff; +_Alignas (double) float fd; +_Alignas (long double) float fld; + +_Alignas (char) double dc; /* { dg-error "cannot reduce alignment" } */ +_Alignas (short int) double ds; /* { dg-error "cannot reduce alignment" } */ +_Alignas (int) double di; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */ +_Alignas (long int) double dl; +_Alignas (long long int) double dll; +_Alignas (float) double df; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */ +_Alignas (double) double dd; +_Alignas (long double) double dld; + +_Alignas (char) long double ldc; /* { dg-error "cannot reduce alignment" } */ +_Alignas (short int) long double lds; /* { dg-error "cannot reduce alignment" } */ +_Alignas (int) long double ldi; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */ +_Alignas (long int) long double ldl; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */ +_Alignas (long long int) long double ldll; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */ +_Alignas (float) long double ldf; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */ +_Alignas (double) long double ldd; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */ +_Alignas (long double) long double ldld; diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr61060.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr61060.c new file mode 100644 index 000000000..d2a136507 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr61060.c @@ -0,0 +1,19 @@ +/* PR target/61060 */ +/* { dg-do compile } */ +/* { dg-options "-O0 -ftree-ter" } */ + +typedef __SIZE_TYPE__ size_t; + +extern inline __attribute__ ((gnu_inline, always_inline, artificial)) +void *memset (void *dest, int ch, size_t len) +{ + return __builtin_memset (dest, ch, len); +} + +char buf[10]; + +void +foo (void) +{ + memset (buf, sizeof (buf), 0); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr61158.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr61158.c new file mode 100644 index 000000000..d0ba7f387 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr61158.c @@ -0,0 +1,12 @@ +/* PR tree-optimization/61158 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-original" } */ + +unsigned long long +foo (unsigned int x) +{ + return ((unsigned long long) x & 0x00ff000000000000ULL) >> 40; +} + +/* { dg-final { scan-tree-dump "return 0;" "original" { target { ilp32 || lp64 } } } } */ +/* { dg-final { cleanup-tree-dump "original" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr61583.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr61583.c new file mode 100644 index 000000000..8424293c1 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr61583.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcompare-debug" } */ + +void +f1 (int n, int b) +{ + extern void f2 (int); + int j; + + if (b) + n = 1; + + if (n < 1) + __builtin_unreachable (); + + for (j = 0; j < n; j++) + f2 (j); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/record-compilation-info-in-elf-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/record-compilation-info-in-elf-1.c new file mode 100644 index 000000000..881281fc7 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/record-compilation-info-in-elf-1.c @@ -0,0 +1,16 @@ +/* { dg-do compile} */ +/* { dg-options "-frecord-compilation-info-in-elf -Dtest -dA" } */ + +void foobar(int); + +void +foo (void) +{ + int i; + for (i = 0; i < 100; i++) + { + foobar(i); + } +} + +/* { dg-final { scan-assembler-times "Dtest" 1 } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr56965-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr56965-1.c new file mode 100644 index 000000000..2512db396 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr56965-1.c @@ -0,0 +1,32 @@ +/* { dg-do run } */ +/* { dg-options "-fschedule-insns" { target scheduling } } */ + +extern void abort (void); + +struct S { + int i; + int j; +}; + +struct U { + struct S s; +} __attribute__((may_alias)); + +int __attribute__((noinline,noclone)) +foo (struct U *p, struct U *q) +{ + int i; + q->s.j = 1; + i = p->s.i; + return i; +} + +int main() +{ + int a[3]; + int *p = a; + p[1] = 0; + if (foo ((struct U *)(p + 1), (struct U *)p) != 1) + abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr56965-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr56965-2.c new file mode 100644 index 000000000..04f55914e --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr56965-2.c @@ -0,0 +1,34 @@ +extern void abort (void); + +struct S { int i; int j; }; +struct X { struct S s; int k; }; +struct Y { int k; struct S s; }; +union U { struct X x; struct Y y; } __attribute__((may_alias)); + +int __attribute__((noinline)) +foo (union U *p, union U *q) +{ + p->x.s.j = 1; + q->y.s.i = 0; + return p->x.s.j; +} + +struct R { int i; int j; } __attribute__((may_alias)); + +int __attribute__((noinline)) +bar (struct R *p, struct R *q) +{ + p->i = 1; + q->j = 0; + return p->i; +} + +int main() +{ + int a[3]; + if (foo ((union U *)&a[0], (union U *)&a[0]) != 0) + abort (); + if (bar ((struct R *)&a[1], (struct R *)&a[0]) != 0) + abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr57864.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr57864.c new file mode 100644 index 000000000..93962c20e --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr57864.c @@ -0,0 +1,37 @@ +/* { dg-do compile } */ + +union U { + double val; + union U *ptr; +}; + +union U *d; +double a; +int b; +int c; + +static void fn1(union U *p1, int p2, _Bool p3) +{ + union U *e; + + if (p2 == 0) + a = ((union U*)((unsigned long)p1 & ~1))->val; + + if (b) { + e = p1; + } else if (c) { + e = ((union U*)((unsigned long)p1 & ~1))->ptr; + d = e; + } else { + e = 0; + d = ((union U*)0)->ptr; + } + + fn1 (e, 0, 0); + fn1 (0, 0, p3); +} + +void fn2 (void) +{ + fn1 (0, 0, 0); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr60891.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr60891.c new file mode 100644 index 000000000..c8fec87ea --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr60891.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-fno-tree-ch -fno-tree-cselim -fno-tree-dominator-opts" } */ + +int a, b, c, d, e, f; + +void foo (int x) +{ + for (;;) + { + int g = c; + if (x) + { + if (e) + while (a) + --f; + } + for (b = 5; b; b--) + { + } + if (!g) + x = 0; + } +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr60903.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr60903.c new file mode 100644 index 000000000..5d93ae3ee --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr60903.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ + +extern int a, b, k, q; + +void +foo () +{ + if (a) + { + while (q) + { + lbl: + if (a) + { + a = 0; + goto lbl; + } + } + b = k; + } + goto lbl; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr60930.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr60930.c new file mode 100644 index 000000000..5e35f1988 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr60930.c @@ -0,0 +1,22 @@ +/* { dg-do run } */ + +int x = 1; + +__attribute__((noinline, noclone)) void +foo (unsigned long long t) +{ + asm volatile ("" : : "r" (&t)); + if (t == 1) + __builtin_abort (); +} + +int +main () +{ +#if __SIZEOF_LONG_LONG__ >= 8 + unsigned long long t = 0xffffffffffffffffULL * (0xffffffffUL * x); + if (t != 0xffffffff00000001ULL) + foo (t);; +#endif + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr61010.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr61010.c new file mode 100644 index 000000000..ed5653982 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr61010.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ + +int main (void) +{ + int a = 0; + unsigned b = (a * 64 & 192) | 63U; + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr61383-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr61383-1.c new file mode 100644 index 000000000..d9a0a0b39 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr61383-1.c @@ -0,0 +1,35 @@ +/* { dg-do run } */ + +int a, b = 1, c, d, e, f, g; + +int +fn1 () +{ + int h; + for (;;) + { + g = b; + g = g ? 0 : 1 % g; + e = a + 1; + for (; d < 1; d = e) + { + if (f == 0) + h = 0; + else + h = 1 % f; + if (f < 1) + c = 0; + else if (h) + break; + } + if (b) + return 0; + } +} + +int +main () +{ + fn1 (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr61452.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr61452.c new file mode 100644 index 000000000..a62de30fd --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr61452.c @@ -0,0 +1,31 @@ +/* { dg-do run } */ + +int a, b; +short c, d; +char e, f; + +int +fn1 (int p1, char p2) +{ + return p1 || p2 ? 0 : p2; +} + +void +fn2 () +{ + for (; a;) + { + int g; + g = c = e; + for (; a;) + b = fn1 (g = d = e, g); + f = g; + } +} + +int +main () +{ + fn2 (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr61681.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr61681.c new file mode 100644 index 000000000..226de0c1a --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr61681.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ + +extern void abort (void); + +int a = 1, *e = &a, **f = &e, *l, *p, j; +static int b; +long d; +short g; + +void +fn1 (int *p) +{ + int m; + if (!(*p & j)) + { + int *n = &m; + for (d = 6; d; d--) + { + for (g = 0; g < 1; g++) + { + n = l = *f; + b = *p; + } + *n = 0; + } + } +} + +int +main () +{ + p = *f; + fn1 (p); + if (b != 0) + abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/crossmodule-indircall-1a.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/crossmodule-indircall-1a.c index a94195cd9..520cad0b2 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/crossmodule-indircall-1a.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/crossmodule-indircall-1a.c @@ -1,6 +1,7 @@ /* It seems there is no way to avoid the other source of mulitple source testcase from being compiled independently. Just avoid error. */ +/* { dg-require-effective-target lto } */ #ifdef DOJOB extern int a; void abort (void); diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/inliner-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/inliner-1.c index e44887b52..99398a60f 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/inliner-1.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/inliner-1.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-options "-O2 --param inline-hot-caller=0 -fdump-tree-optimized" } */ int a; int b[100]; void abort (void); @@ -34,7 +34,7 @@ main () return 0; } -/* cold function should be inlined, while hot function should not. +/* cold function should be not inlined, while hot function should be. Look for "cold_function () [tail call];" call statement not for the declaration or other appearances of the string in dump. */ /* { dg-final-use { scan-tree-dump "cold_function ..;" "optimized"} } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/bb-reorg_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/bb-reorg_0.c new file mode 100644 index 000000000..f850c9bfd --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/bb-reorg_0.c @@ -0,0 +1,39 @@ +/* { dg-require-effective-target freorder } */ +/* { dg-options "-O2 -freorder-blocks-and-partition" } */ + +#include <string.h> + +#define SIZE 1000 +int t0 = 0; +const char *t2[SIZE]; +char buf[SIZE]; + +void +foo (void) +{ + char *s = buf; + t0 = 1; + + for (;;) + { + if (*s == '\0') + break; + else + { + t2[t0] = s; + t0++; + } + *s++ = '\0'; + } + t2[t0] = NULL; +} + + +int +main () +{ + strcpy (buf, "hello"); + foo (); + return 0; +} + diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/ic-misattribution-1_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/ic-misattribution-1_0.c new file mode 100644 index 000000000..ff103a8c5 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/ic-misattribution-1_0.c @@ -0,0 +1,19 @@ +/* { dg-options "-O2 -fdump-ipa-profile" } */ + +extern void callee (void); +extern void caller (void (*func) (void)); + +typedef void (*func_t) (void); +func_t func; + +int +main () +{ + func = callee; + caller (callee); + func (); + return 0; +} + +/* { dg-final-use { scan-ipa-dump-times "Indirect call -> direct call" 2 "profile" } } */ +/* { dg-final-use { cleanup-ipa-dump "profile" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/ic-misattribution-1_1.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/ic-misattribution-1_1.c new file mode 100644 index 000000000..4948ec4fa --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/ic-misattribution-1_1.c @@ -0,0 +1,18 @@ +/* { dg-options "-O2 -fdump-ipa-profile" } */ + +extern void other_caller (void); + +void +callee (void) +{ + return; +} + +void +caller(void (*func) (void)) +{ + func (); +} + +/* { dg-final-use { scan-ipa-dump "Indiret call -> direct call" "profile" } } */ +/* { dg-final-use { cleanup-ipa-dump "profile" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof-single_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof-single_0.c new file mode 100644 index 000000000..29a216c69 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof-single_0.c @@ -0,0 +1,43 @@ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile" } */ + +static int a1 (void) +{ + return 10; +} + +static int a2 (void) +{ + return 0; +} + +typedef int (*tp) (void); + +static tp aa [] = {a2, a1, a1, a1, a1}; + +__attribute__((noinline)) void setp (int (**pp) (void), int i) +{ + if (!i) + *pp = aa [i]; + else + *pp = aa [(i & 2) + 1]; +} + +int +main (void) +{ + int (*p) (void); + int i; + + for (i = 0; i < 10; i ++) + { + setp (&p, i); + p (); + } + + return 0; +} + +/* { dg-final-use { scan-ipa-dump "Indirect call -> direct call.* a1" "profile"} } */ +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ +/* { dg-final-use { cleanup-ipa-dump "profile" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof_0.c new file mode 100644 index 000000000..6bd048df6 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof_0.c @@ -0,0 +1,23 @@ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile" } */ + +extern void setp (int (**pp) (void), int i); + +int +main (void) +{ + int (*p) (void); + int i; + + for (i = 0; i < 10; i ++) + { + setp (&p, i); + p (); + } + + return 0; +} + +/* { dg-final-use { scan-ipa-dump "Indirect call -> direct call.* a1" "profile"} } */ +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ +/* { dg-final-use { cleanup-ipa-dump "profile" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof_1.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof_1.c new file mode 100644 index 000000000..0cdb607cd --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof_1.c @@ -0,0 +1,23 @@ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile" } */ + +int a1 (void) +{ + return 10; +} + +int a2 (void) +{ + return 0; +} + +typedef int (*tp) (void); + +tp aa [] = {a2, a1, a1, a1, a1}; + +__attribute__((noinline)) void setp (int (**pp) (void), int i) +{ + if (!i) + *pp = aa [i]; + else + *pp = aa [(i & 2) + 1]; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/inliner-1_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/inliner-1_0.c new file mode 100644 index 000000000..a82b95d82 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/inliner-1_0.c @@ -0,0 +1,42 @@ +/* { dg-options "-O2 --param inline-hot-caller=0 -fdump-tree-optimized" } */ +int a; +int b[100]; +void abort (void); + +inline void +cold_function () +{ + int i; + for (i = 0; i < 99; i++) + if (b[i] / (b[i+1] + 1)) + abort (); +} + +inline void +hot_function () +{ + int i; + for (i = 0; i < 99; i++) + if (b[i] / (b[i+1] + 1)) + abort (); +} + +main () +{ + int i; + for (i = 0; i < 100; i++) + { + if (a) + cold_function (); + else + hot_function (); + } + return 0; +} + +/* cold function should not be inlined, while hot function should be. + Look for "cold_function () [tail call];" call statement not for the + declaration or other apperances of the string in dump. */ +/* { dg-final-use { scan-tree-dump "cold_function ..;" "optimized"} } */ +/* { dg-final-use { scan-tree-dump-not "hot_function ..;" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/lipo.exp b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/lipo.exp new file mode 100644 index 000000000..26abc7f88 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/lipo.exp @@ -0,0 +1,60 @@ +# Copyright (C) 2001, 2002, 2004, 2005, 2007, 2008 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# Test the functionality of programs compiled with profile-directed block +# ordering using -fprofile-generate followed by -fbranch-use. + +load_lib target-supports.exp + +# Some targets don't support tree profiling. +if { ![check_profiling_available ""] } { + return +} + +# The procedures in profopt.exp need these parameters. +set tool gcc +set prof_ext [list {gcda} {gcda.imports} ] + +# Override the list defined in profopt.exp. +set PROFOPT_OPTIONS [list {}] + +if $tracelevel then { + strace $tracelevel +} + +# Load support procs. +load_lib profopt.exp + +# These are globals used by profopt-execute. The first is options +# needed to generate profile data, the second is options to use the +# profile data. +set profile_option "-fprofile-generate -fripa -D_PROFILE_GENERATE" +set feedback_option "-fprofile-use -fripa -D_PROFILE_USE" + +# Add -fno-section-anchors for powerpc. Workround for Google ref b/6663281 +if {[istarget powerpc*-*-*]} { + set profile_option "$profile_option -fno-section-anchors" + set feedback_option "$feedback_option -fno-section-anchors" +} + +foreach src [lsort [glob -nocomplain $srcdir/$subdir/*_0.c]] { + # If we're only testing specific files and this isn't one of them, skip it. + if ![runtest_file_p $runtests $src] then { + continue + } + profopt-execute $src +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/lipo_inline1_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/lipo_inline1_0.c new file mode 100644 index 000000000..d48080981 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/lipo_inline1_0.c @@ -0,0 +1,29 @@ +/* { dg-options "-O2 -fdump-tree-optimized-details-blocks -fdump-ipa-inline-details -fopt-info" } */ + +extern int foo (void); +extern int goo (void); + + +int bar (void) +{ + return 2; +} + +int g; +int main () +{ + int s = 0, i; + + for (i = 0; i < 1000; i ++) + { + s += foo(); /* Should be inlined */ + s += goo(); /* Should be inlined */ + } + + g = s; + return 0; +} + +/* { dg-final-use { scan-tree-dump-not "foo" "optimized"} } */ +/* { dg-final-use { scan-tree-dump-not "goo" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/lipo_inline1_1.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/lipo_inline1_1.c new file mode 100644 index 000000000..9725ca769 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/lipo_inline1_1.c @@ -0,0 +1,22 @@ +extern int bar(void); +extern int blah(void); +int foo (void) +{ + int i, s = 0; + + for (i = 0; i < 2; i++) + { + s += bar(); /* Inlined */ + s += blah(); /* Inlined */ + } + return s; +} + +int goo (void) +{ + return 10; +} + +/* { dg-final-use { scan-tree-dump-not "bar" "optimized"} } */ +/* { dg-final-use { scan-tree-dump-not "blah" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/lipo_inline1_2.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/lipo_inline1_2.c new file mode 100644 index 000000000..9eeadb20a --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/lipo_inline1_2.c @@ -0,0 +1,6 @@ +int blah (void) +{ + return 2; +} + +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/pr34999_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/pr34999_0.c new file mode 100644 index 000000000..4ec42790e --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/pr34999_0.c @@ -0,0 +1,45 @@ +/* Same test as built-in-setjmp.c. Includes the case where + the source block of a crossing fallthru edge ends with a call. */ +/* { dg-require-effective-target freorder } */ +/* { dg-options "-O2 -freorder-blocks-and-partition" } */ + +extern int strcmp(const char *, const char *); +extern char *strcpy(char *, const char *); +extern void abort(void); +extern void exit(int); + +void *buf[20]; + +void __attribute__((noinline)) +sub2 (void) +{ + __builtin_longjmp (buf, 1); +} + +int +main () +{ + char *p = (char *) __builtin_alloca (20); + + strcpy (p, "test"); + + if (__builtin_setjmp (buf)) + { + if (strcmp (p, "test") != 0) + abort (); + + exit (0); + } + + { + int *q = (int *) __builtin_alloca (p[2] * sizeof (int)); + int i; + + for (i = 0; i < p[2]; i++) + q[i] = 0; + + while (1) + sub2 (); + } +} + diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/pr45354_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/pr45354_0.c new file mode 100644 index 000000000..b30ad7769 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/pr45354_0.c @@ -0,0 +1,43 @@ +/* { dg-require-effective-target freorder } */ +/* { dg-options "-O -freorder-blocks-and-partition -fschedule-insns -fselective-scheduling" { target powerpc*-*-* ia64-*-* x86_64-*-* } } */ + +extern void abort (void); + +int ifelse_val2; + +int __attribute__((noinline)) +test_ifelse2 (int i) +{ + int result = 0; + if (!i) /* count(6) */ + result = 1; /* count(1) */ + if (i == 1) /* count(6) */ + result = 1024; + if (i == 2) /* count(6) */ + result = 2; /* count(3) */ + if (i == 3) /* count(6) */ + return 8; /* count(2) */ + if (i == 4) /* count(4) */ + return 2048; + return result; /* count(4) */ +} + +void __attribute__((noinline)) +call_ifelse () +{ + ifelse_val2 += test_ifelse2 (0); + ifelse_val2 += test_ifelse2 (2); + ifelse_val2 += test_ifelse2 (2); + ifelse_val2 += test_ifelse2 (2); + ifelse_val2 += test_ifelse2 (3); + ifelse_val2 += test_ifelse2 (3); +} + +int +main() +{ + call_ifelse (); + if (ifelse_val2 != 23) + abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/pr47187_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/pr47187_0.c new file mode 100644 index 000000000..467ce252b --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/pr47187_0.c @@ -0,0 +1,23 @@ +/* PR bootstrap/47187 */ +/* { dg-options "-O2" } */ + +char buf[64]; +char buf2[64]; + +void * +foo (char *p, long size) +{ + return __builtin_memcpy (buf, p, size); +} + +int +main (void) +{ + long i; + for (i = 0; i < 65536; i++) + if (foo ("abcdefghijkl", 12) != buf) + __builtin_abort (); + if (foo (buf2, 64) != buf) + __builtin_abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/stringop-1_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/stringop-1_0.c new file mode 100644 index 000000000..f73061387 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/stringop-1_0.c @@ -0,0 +1,22 @@ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile" } */ +int a[1000]; +int b[1000]; +int size=1; +int max=10000; +main() +{ + int i; + for (i=0;i<max; i++) + { + __builtin_memcpy (a, b, size * sizeof (a[0])); + asm(""); + } + return 0; +} +/* { dg-final-use { scan-ipa-dump "Single value 4 stringop" "profile"} } */ +/* Really this ought to simplify into assignment, but we are not there yet. */ +/* a[0] = b[0] is what we fold the resulting memcpy into. */ +/* { dg-final-use { scan-tree-dump " = MEM.*&b" "optimized"} } */ +/* { dg-final-use { scan-tree-dump "MEM.*&a\\\] = " "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ +/* { dg-final-use { cleanup-ipa-dump "profile" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/stringop-2_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/stringop-2_0.c new file mode 100644 index 000000000..d5c58561b --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/stringop-2_0.c @@ -0,0 +1,20 @@ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile" } */ +int a[1000]; +int b[1000]; +int size=1; +int max=10000; +main() +{ + int i; + for (i=0;i<max; i++) + { + __builtin_memset (a, 10, size * sizeof (a[0])); + asm(""); + } + return 0; +} +/* { dg-final-use { scan-ipa-dump "Single value 4 stringop" "profile"} } */ +/* The versioned memset of size 4 should be optimized to an assignment. */ +/* { dg-final-use { scan-tree-dump "a\\\[0\\\] = 168430090" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ +/* { dg-final-use { cleanup-ipa-dump "profile" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/tracer-1_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/tracer-1_0.c new file mode 100644 index 000000000..385a1a5c2 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/tracer-1_0.c @@ -0,0 +1,18 @@ +/* { dg-options "-O2 -ftracer -fdump-tree-tracer" } */ +volatile int a, b, c; +int main () +{ + int i; + for (i = 0; i < 1000; i++) + { + if (i % 17) + a++; + else + b++; + c++; + } + return 0; +} +/* Superblock formation should produce two copies of the increment of c */ +/* { dg-final-generate { scan-tree-dump-times "c =" 2 "tracer" } } */ +/* { dg-final-use { cleanup-tree-dump "tracer" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/update-cunroll-2_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/update-cunroll-2_0.c new file mode 100644 index 000000000..d559b9245 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/update-cunroll-2_0.c @@ -0,0 +1,21 @@ + +/* { dg-options "-O2 -fdump-tree-optimized-blocks" } */ +int a[8]; +__attribute__ ((noinline)) +int t() +{ + int i; + for (i = 0; i < 3; i++) + if (a[i]) + break; + return i; +} +main () +{ + int i; + for (i = 0; i < 1000; i++) + t (); + return 0; +} +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/update-loopch_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/update-loopch_0.c new file mode 100644 index 000000000..e45c67461 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/update-loopch_0.c @@ -0,0 +1,20 @@ +/* { dg-options "-O2 -fdump-ipa-profile-blocks -fdump-tree-optimized-blocks-details" } */ +int max = 33333; +int a[8]; +int +main () +{ + int i; + for (i = 0; i < max; i++) + { + a[i % 8]++; + } + return 0; +} +/* Loop header copying will peel away the initial conditional, so the loop body + is once reached directly from entry point of function, rest via loopback + edge. */ +/* { dg-final-use { scan-ipa-dump "count:33333" "profile"} } */ +/* { dg-final-use { scan-tree-dump "count:33332" "optimized"} } */ +/* { dg-final-use { cleanup-ipa-dump "profile" } } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/update-tailcall_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/update-tailcall_0.c new file mode 100644 index 000000000..285491445 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/update-tailcall_0.c @@ -0,0 +1,20 @@ +/* { dg-options "-O2 -fdump-tree-tailc -fdump-tree-optimized" } */ +__attribute__ ((noinline)) +int factorial(int x) +{ + if (x == 1) + return 1; + else + return x*factorial(--x); +} +int gbl; +int +main() +{ + gbl = factorial(100); + return 0; +} +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "tailc"} } */ +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "tailc" } } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/val-prof-1_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/val-prof-1_0.c new file mode 100644 index 000000000..d6f603e8b --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/val-prof-1_0.c @@ -0,0 +1,22 @@ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile" } */ +int a[1000]; +int b = 256; +int c = 257; +main () +{ + int i; + int n; + for (i = 0; i < 1000; i++) + { + if (i % 17) + n = c; + else n = b; + a[i] /= n; + } + return 0; +} +/* { dg-final-use { scan-ipa-dump "Div.mod by constant n_\[0-9\]*=257 transformation on insn" "profile"} } */ +/* { dg-final-use { scan-tree-dump "if \\(n_\[0-9\]* != 257\\)" "optimized"} } */ +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ +/* { dg-final-use { cleanup-ipa-dump "profile" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/val-prof-2_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/val-prof-2_0.c new file mode 100644 index 000000000..16839612d --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/val-prof-2_0.c @@ -0,0 +1,32 @@ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile" } */ +unsigned int a[1000]; +unsigned int b = 256; +unsigned int c = 1024; +unsigned int d = 17; +main () +{ + int i; + unsigned int n; + for (i = 0; i < 1000; i++) + { + a[i]=100*i; + } + for (i = 0; i < 1000; i++) + { + if (i % 2) + n = b; + else if (i % 3) + n = c; + else + n = d; + a[i] %= n; + } + return 0; +} +/* { dg-final-use { scan-ipa-dump "Mod power of 2 transformation on insn" "profile" } } */ +/* This is part of code checking that n is power of 2, so we are sure that the transformation + didn't get optimized out. */ +/* { dg-final-use { scan-tree-dump "n_\[0-9\]* \\+ (4294967295|0x0*ffffffff)" "optimized"} } */ +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ +/* { dg-final-use { cleanup-ipa-dump "profile" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/val-prof-3_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/val-prof-3_0.c new file mode 100644 index 000000000..d7b3914a8 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/val-prof-3_0.c @@ -0,0 +1,32 @@ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile" } */ +unsigned int a[1000]; +unsigned int b = 257; +unsigned int c = 1023; +unsigned int d = 19; +main () +{ + int i; + unsigned int n; + for (i = 0; i < 1000; i++) + { + a[i]=18; + } + for (i = 0; i < 1000; i++) + { + if (i % 2) + n = b; + else if (i % 3) + n = c; + else + n = d; + a[i] %= n; + } + return 0; +} +/* { dg-final-use { scan-ipa-dump "Mod subtract transformation on insn" "profile" } } */ +/* This is part of code checking that n is greater than the divisor so we are sure that it + didn't get optimized out. */ +/* { dg-final-use { scan-tree-dump "if \\(n_\[0-9\]* \\>" "optimized"} } */ +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ +/* { dg-final-use { cleanup-ipa-dump "profile" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/val-prof-4_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/val-prof-4_0.c new file mode 100644 index 000000000..239bf595d --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/val-prof-4_0.c @@ -0,0 +1,32 @@ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile" } */ +unsigned int a[1000]; +unsigned int b = 999; +unsigned int c = 1002; +unsigned int d = 1003; +main () +{ + int i; + unsigned int n; + for (i = 0; i < 1000; i++) + { + a[i]=1000+i; + } + for (i = 0; i < 1000; i++) + { + if (i % 2) + n = b; + else if (i % 3) + n = c; + else + n = d; + a[i] %= n; + } + return 0; +} +/* { dg-final-use { scan-ipa-dump "Mod subtract transformation on insn" "profile" } } */ +/* This is part of code checking that n is greater than the divisor so we are sure that it + didn't get optimized out. */ +/* { dg-final-use { scan-tree-dump "if \\(n_\[0-9\]* \\>" "optimized"} } */ +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ +/* { dg-final-use { cleanup-ipa-dump "profile" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/val-prof-5_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/val-prof-5_0.c new file mode 100644 index 000000000..1a804a767 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/val-prof-5_0.c @@ -0,0 +1,17 @@ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile" } */ +int a[1000]; +int b=997; +main() +{ + int i; + for (i = 0; i < 1000; i++) + if (a[i]) + a[i]/=b; + else + a[i]/=b; + return 0; +} +/* { dg-final-use { scan-ipa-dump "Div.mod by constant b.*=997 transformation on insn" "profile" } } */ +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ +/* { dg-final-use { cleanup-ipa-dump "profile" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/val-prof-6_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/val-prof-6_0.c new file mode 100644 index 000000000..c439fcffe --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/val-prof-6_0.c @@ -0,0 +1,20 @@ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +char a[1000]; +char b[1000]; +int size=1000; +__attribute__ ((noinline)) +t(int size) +{ + __builtin_memcpy(a,b,size); +} +int +main() +{ + int i; + for (i=0; i < size; i++) + t(i); + return 0; +} +/* { dg-final-use { scan-tree-dump "Average value sum:499500" "optimized"} } */ +/* { dg-final-use { scan-tree-dump "IOR value" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/val-prof-7_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/val-prof-7_0.c new file mode 100644 index 000000000..5f5326384 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/val-prof-7_0.c @@ -0,0 +1,26 @@ +/* { dg-options "-O2 -fdump-ipa-profile -mtune=core2" } */ +/* { dg-skip-if "" { ! { i?86-*-* x86_64-*-* } } { "*" } { "" } } */ + +#include <strings.h> + +int foo(int len) +{ + char array[1000]; + bzero(array, len); + return 0; +} + +int main() { + int i; + for (i = 0; i < 1000; i++) + { + if (i > 990) + foo(16); + else + foo(8); + } + return 0; +} + +/* { dg-final-use { scan-ipa-dump "Single value 8 stringop transformation on bzero" "profile" } } */ +/* { dg-final-use { cleanup-ipa-dump "profile" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/wcoverage-mismatch_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/wcoverage-mismatch_0.c new file mode 100644 index 000000000..e4231057f --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/wcoverage-mismatch_0.c @@ -0,0 +1,20 @@ +/* { dg-options "-O2 -Wno-coverage-mismatch" } */ + +int __attribute__((noinline)) bar (void) +{ +} + +int foo (int i) +{ +#ifdef _PROFILE_USE + if (i) + bar (); +#endif + return 0; +} + +int main(int argc, char **argv) +{ + foo (argc); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/merge_block.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/merge_block.c new file mode 100644 index 000000000..91bd47482 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/merge_block.c @@ -0,0 +1,21 @@ + +/* { dg-options "-O2 -fno-ipa-pure-const -fdump-tree-optimized-blocks -fno-early-inlining" } */ +int a[8]; +int t() +{ + int i; + for (i = 0; i < 3; i++) + if (a[i]) + break; + return i; +} +main () +{ + int i; + /* The loop will be optimized away after ipa-inline. */ + for (i = 0; i < 1000; i++) + t (); + return 0; +} +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ivopt_1.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ivopt_1.c index 74b73da68..c2f7ebd26 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ivopt_1.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ivopt_1.c @@ -1,5 +1,5 @@ /* { dg-do compile { target {{ i?86-*-* x86_64-*-* } && lp64 } } } */ -/* { dg-options "-O2 -m64 -fdump-tree-ivopts" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -m64 -fdump-tree-ivopts" } */ #define TYPE char* /* Testing that only one induction variable is selected after IVOPT on diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ivopt_2.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ivopt_2.c index f27b90072..87334c61c 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ivopt_2.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ivopt_2.c @@ -1,5 +1,5 @@ /* { dg-do compile { target {{ i?86-*-* x86_64-*-* } && lp64 } } } */ -/* { dg-options "-O2 -m64 -fdump-tree-ivopts" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -m64 -fdump-tree-ivopts" } */ #define TYPE char* diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ivopt_4.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ivopt_4.c index 330b3bf53..bd6393e58 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ivopt_4.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ivopt_4.c @@ -1,5 +1,5 @@ /* { dg-do compile { target {{ i?86-*-* x86_64-*-* } && lp64 } } } */ -/* { dg-options "-O2 -m64 -fdump-tree-ivopts" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -m64 -fdump-tree-ivopts" } */ #ifndef TYPE #define TYPE char* diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ivopts-lt.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ivopts-lt.c index 5188fed2c..d1e03e365 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ivopts-lt.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ivopts-lt.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-ivopts" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -fdump-tree-ivopts" } */ /* { dg-require-effective-target stdint_types } */ #include "stdint.h" diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/loop-16.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/loop-16.c index 50fa33330..4b41ebe16 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/loop-16.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/loop-16.c @@ -2,7 +2,7 @@ at most 100 times, thus the (32-bit) induction variables do not overflow, and we may use 64-bit variable to represent them. */ -/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -fdump-tree-optimized" } */ /* { dg-do compile { target x86_64-*-* } } */ unsigned a[100]; diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c index f1e52e5d8..b4490d52e 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/predcom-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-do run } */ -/* { dg-options "-O2 -funroll-loops --param max-unroll-times=8 -fpredictive-commoning -fdump-tree-pcom-details" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -funroll-loops --param max-unroll-times=8 -fpredictive-commoning -fdump-tree-pcom-details" } */ void abort (void); diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/predcom-4.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/predcom-4.c index c29a46ac2..3164c4569 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/predcom-4.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/predcom-4.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-do run } */ -/* { dg-options "-O2 -funroll-loops --param max-unroll-times=8 -fpredictive-commoning -fdump-tree-pcom-details" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -funroll-loops --param max-unroll-times=8 -fpredictive-commoning -fdump-tree-pcom-details" } */ /* Test for predictive commoning of expressions, without reassociation. */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/predcom-5.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/predcom-5.c index 29444abe5..b830c4d65 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/predcom-5.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/predcom-5.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-do run } */ -/* { dg-options "-O2 -funroll-loops --param max-unroll-times=8 -fpredictive-commoning -fdump-tree-pcom-details" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -funroll-loops --param max-unroll-times=8 -fpredictive-commoning -fdump-tree-pcom-details" } */ /* Test for predictive commoning of expressions, with reassociation. */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/prefetch-7.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/prefetch-7.c index 5c469ba00..3af204a57 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/prefetch-7.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/prefetch-7.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ /* { dg-require-effective-target sse2 } */ /* { dg-skip-if "" { i?86-*-* x86_64-*-* } { "-march=*" } { "-march=athlon" } } */ -/* { dg-options "-O2 -fprefetch-loop-arrays -march=athlon -msse2 -mfpmath=sse --param simultaneous-prefetches=100 -fdump-tree-aprefetch-details -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -fprefetch-loop-arrays -march=athlon -msse2 -mfpmath=sse --param simultaneous-prefetches=100 -fdump-tree-aprefetch-details -fdump-tree-optimized" } */ #define K 1000000 int a[K]; diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/prefetch-8.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/prefetch-8.c index 705d35fe2..31dc31469 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/prefetch-8.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/prefetch-8.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ /* { dg-require-effective-target sse2 } */ /* { dg-skip-if "" { i?86-*-* x86_64-*-* } { "-march=*" } { "-march=athlon" } } */ -/* { dg-options "-O2 -fprefetch-loop-arrays -march=athlon -msse2 -mfpmath=sse --param simultaneous-prefetches=100 -fdump-tree-aprefetch-details -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -fprefetch-loop-arrays -march=athlon -msse2 -mfpmath=sse --param simultaneous-prefetches=100 -fdump-tree-aprefetch-details -fdump-tree-optimized" } */ #define K 1000000 int a[K]; diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/prefetch-9.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/prefetch-9.c index f78bea3a4..afbb8a047 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/prefetch-9.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/prefetch-9.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ /* { dg-require-effective-target sse2 } */ /* { dg-skip-if "" { i?86-*-* x86_64-*-* } { "-march=*" } { "-march=athlon" } } */ -/* { dg-options "-O2 -fprefetch-loop-arrays -march=athlon -msse2 -mfpmath=sse --param simultaneous-prefetches=100 -fdump-tree-aprefetch-details -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -fprefetch-loop-arrays -march=athlon -msse2 -mfpmath=sse --param simultaneous-prefetches=100 -fdump-tree-aprefetch-details -fdump-tree-optimized" } */ #define K 1000000 int a[K], b[K]; diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/vrp93.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/vrp93.c new file mode 100644 index 000000000..d78c399c3 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/vrp93.c @@ -0,0 +1,36 @@ +/* PR target/29776 */ +/* PR tree-optimization/61725 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ +/* { dg-final { scan-tree-dump-not "link_error" "vrp1"} } */ +/* { dg-final { cleanup-tree-dump "vrp1" } } */ + +#define A(fn, arg, min, max) \ + if (__builtin_##fn (arg) < min || __builtin_##fn (arg) > max) \ + link_error (); +#define B(fn, min, max) \ + A (fn, a, min, max) A (fn##l, b, min, max) A (fn##ll, c, min, max) +#define C(fn, min, sub) \ + A (fn, a, min, ((int) sizeof (a) * __CHAR_BIT__ - sub)) \ + A (fn##l, b, min, ((int) sizeof (b) * __CHAR_BIT__ - sub)) \ + A (fn##ll, c, min, ((int) sizeof (c) * __CHAR_BIT__ - sub)) + +extern void link_error (void); + +unsigned int d; +unsigned long e; +unsigned long long f; + +void +foo (int a, long b, long long c) +{ + C (ffs, 0, 0) + a &= 63; b &= 63; c &= 63; + B (ffs, 0, 6) + a++; b++; c++; + B (ffs, 1, 7) + a -= 2; b -= 2; c -= 2; + C (ffs, 0, 0) + a -= 63; b -= 63; c -= 63; + C (ffs, 1, 0) +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/typeof-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/typeof-2.c new file mode 100644 index 000000000..e9169003a --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/typeof-2.c @@ -0,0 +1,28 @@ +/* Test qualifier discard of typeof for atomic types. */ +/* { dg-do compile } */ +/* { dg-options "-std=c11" } */ + +extern int i; + +extern int * p; + +extern int _Atomic const ci; +extern __typeof (ci) i; + +extern int _Atomic volatile vi; +extern __typeof (vi) i; + +extern int * _Atomic restrict ri; +extern __typeof (ri) p; + +void f(void) +{ + __auto_type aci = ci; + int *paci = &aci; + + __auto_type avi = vi; + int *pavi = &avi; + + __auto_type ari = ri; + int **pari = &ari; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/unused-8b.c b/gcc-4.9/gcc/testsuite/gcc.dg/unused-8b.c new file mode 100644 index 000000000..5b4b89493 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/unused-8b.c @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall -Wno-unused -Wextra" } */ + +void foo(int x) { } diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/var-expand1.c b/gcc-4.9/gcc/testsuite/gcc.dg/var-expand1.c index a784ea1a0..b4580ea8a 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/var-expand1.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/var-expand1.c @@ -2,7 +2,7 @@ /* We don't (and don't want to) perform this optimisation on soft-float targets, where each addition is a library call. */ /* { dg-require-effective-target hard_float } */ -/* { dg-options "-O2 -funroll-loops --fast-math -fvariable-expansion-in-unroller -fdump-rtl-loop2_unroll" } */ +/* { dg-options "-O2 -fno-tree-loop-vectorize -funroll-loops --fast-math -fvariable-expansion-in-unroller -fdump-rtl-loop2_unroll" } */ extern void abort (void); diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr60841.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr60841.c new file mode 100644 index 000000000..44b5d0191 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr60841.c @@ -0,0 +1,183 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-ffast-math" } */ + +/* This testcase shouldn't consume much memory or produce a 1GB vectorizer + dump file due to SLP tree explosion. */ + +struct S { int f1, f2, f3, f4; } a; +struct T { short f3, f2, f1, f4; }; +int b, c, d, e, f, g; +unsigned long z; + +void +foo (struct T *p, struct T *q, int x, int w) +{ + for (; x; x++) + { + struct S h; + int i; + struct T j; + struct T *r; + h = a; + g = 0; + r = p + 2 * (c + 4) + 1; + j = *r; + r = p; + f = r->f1 - 1; + b = +1.0 + f * f; + i = (r->f2 + j.f2) / 2; + f = r->f3 - 1; + b += 1.0 - i * f * f; + f = r->f4 - 1; + if (b) + b += -1.0 - i * f; + if (b / w) + { + h.f1 += 8.0 * r->f1; + h.f2 += 8.0 * r->f2; + h.f3 += 8.0 * r->f3; + h.f4 += 8.0 * r->f4; + g = 1; + } + r++; + f = r->f1; + i = (r->f2 + j.f2) / 2; + f = r->f3 - 1; + b += 1.0 - i * f * f; + i = (r->f4); + if (b * 65535UL / w) + { + h.f1 += 10.0 * r->f1; + h.f2 += 10.0 * r->f2; + h.f3 += 10.0 * r->f3; + h.f4 += 10.0 * r->f4; + g += 10.0; + } + r++; + f = r->f1; + z = 5UL * i; + f = r->f2; + i = (r->f3 + j.f3) / 2; + b = -i * f * f; + i = (r->f4 + j.f4) / 2; + if (b * 65535UL / 25.0f) + { + h.f1 += 8.0 * r->f1; + h.f2 += 8.0 * r->f2; + h.f3 += 8.0 * r->f3; + h.f4 += 8.0 * r->f4; + g += 8.0; + } + r++; + f = r->f1 - j.f1; + b = 1 * 2.0 * i * f * f; + f = r->f2; + b += 4.0 * f; + i = r->f3 / 2; + f = r->f4 - 1; + if (b * 1) + { + h.f1 += 8.0 * r->f1; + h.f2 += 8.0 * r->f2; + h.f3 += 8.0 * r->f3; + h.f4 += 8.0 * r->f4; + g += 8.0; + } + b = 4.0 * 1 * f; + if (b * 65535UL / 25.0f) + { + h.f1 += 20.0 * r->f1; + h.f2 += 20.0 * r->f2; + h.f3 += 20.0 * r->f3; + h.f4 += 20.0 * r->f4; + g += 20.0; + } + b = 5 * (0.0 - i); + if (b < 0) + { + h.f1 += 8.0 * r->f1; + h.f2 += 8.0 * r->f2; + h.f3 += 8.0 * r->f3; + h.f4 += 8.0 * r->f4; + g += 8.0; + } + r = p + 2 * (c + 4); + i = (r->f1 + j.f1); + b = 1 * 2.0 * i * 1; + f = r->f2 - 1; + i = (r->f3 + j.f3) / 2; + b = 5 * (0.0 - i) * f * f; + i = (r->f4 + j.f4) / 2; + if (b * 65535UL / 25.0f) + { + h.f1 += 10.0 * r->f1; + h.f2 += 10.0 * r->f2; + h.f3 += 10.0 * r->f3; + h.f4 += 10.0 * r->f4; + g += 10.0; + } + r++; + f = r->f1; + b = 5UL * i * f; + i = (r->f2 + j.f2) / 2; + f = r->f3 - 1; + b = 5 * (0.0 - i) * f * f; + f = r->f4 - 1; + if (b * 65535UL / 25.0f) + { + h.f1 += 40.0 * r->f1; + h.f2 += 40.0 * r->f2; + h.f3 += 40.0 * r->f3; + h.f4 += 40.0 * r->f4; + g += 40.0; + } + r++; + i = (r->f1 + j.f1); + b = 5 * i * f; + f = r->f2; + b = 4.0 * f * f; + f = r->f3; + i = (r->f4 + j.f4) / 2; + b = 5 * (0.0 - i) * f * f; + if (b * 25.0f) + { + h.f1 += 8.0 * r->f1; + h.f2 += 8.0 * r->f2; + h.f3 += 8.0 * r->f3; + h.f4 += 8.0 * r->f4; + g += 8.0; + } + r = p + 4 * (c + 4); + i = r->f1 / 2; + b = 5 * (1.0 + i); + i = r->f2 + j.f2; + f = r->f3 - 1; + b = 5 * (0.0 - i) * f * f; + i = (r->f4 + j.f4) / 2; + if (b * 65535UL / 25.0f) + { + h.f1 += 5.0 * r->f1; + h.f2 += 5.0 * r->f2; + h.f3 += 5.0 * r->f3; + h.f4 += 5.0 * r->f4; + g += 5.0; + } + b = 5 * (1.0 + i); + if (b < 0) + { + h.f1 += 5.0 * r->f1; + h.f2 += 5.0 * r->f2; + h.f3 += 5.0 * r->f3; + h.f4 += 5.0 * r->f4; + g += 5.0; + } + q->f1 = (h.f1 + g / 2 - 1) / g; + q->f2 = (h.f2 + g / 2 - 1) / g; + q->f3 = (h.f3 + g / 2 - 1) / g; + q->f4 = (h.f4 + g / 2 - 1) / g; + p++; + q++; + } +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr61680.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr61680.c new file mode 100644 index 000000000..605a651aa --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr61680.c @@ -0,0 +1,51 @@ +/* { dg-do run } */ + +#include "tree-vect.h" + +double v[4096][4]; + +__attribute__((noinline, noclone)) void +bar (double p[][4]) +{ + int i; + double d = 172.0; + for (i = 0; i < 4096; i++) + { + if (p[i][0] != 6.0 || p[i][1] != 6.0 || p[i][2] != 10.0) + __builtin_abort (); + if (__builtin_fabs (p[i][3] - d) > 0.25) + __builtin_abort (); + } +} + +__attribute__((noinline, noclone)) void +foo (void) +{ + int i; + double w[4096][4], t; + for (i = 0; i < 4096; i++) + { + w[i][0] = v[i][0] + 2.0; + w[i][1] = v[i][1] + 1.0; + w[i][2] = v[i][2] + 4.0; + w[i][3] = (w[i][0] * w[i][0] + w[i][1] * w[i][1] + w[i][2] * w[i][2]); + } + bar (w); +} + +int +main () +{ + int i; + + check_vect (); + + for (i = 0; i < 4096; i++) + { + v[i][0] = 4.0; + v[i][1] = 5.0; + v[i][2] = 6.0; + } + foo (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/vect-reduc-sad.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/vect-reduc-sad.c new file mode 100644 index 000000000..15a625f6a --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/vect-reduc-sad.c @@ -0,0 +1,54 @@ +/* { dg-require-effective-target vect_usad_char } */ + +#include <stdarg.h> +#include "tree-vect.h" + +#define N 64 +#define SAD N*N/2 + +unsigned char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); +unsigned char Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); + +/* Sum of absolute differences between arrays of unsigned char types. + Detected as a sad pattern. + Vectorized on targets that support sad for unsigned chars. */ + +__attribute__ ((noinline)) int +foo (int len) +{ + int i; + int result = 0; + + for (i = 0; i < len; i++) + result += abs (X[i] - Y[i]); + + return result; +} + + +int +main (void) +{ + int i; + int sad; + + check_vect (); + + for (i = 0; i < N; i++) + { + X[i] = i; + Y[i] = N - i; + __asm__ volatile (""); + } + + sad = foo (N); + if (sad != SAD) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vect_recog_sad_pattern: detected" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/vect-singleton_1.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/vect-singleton_1.c new file mode 100644 index 000000000..6c2ff49cd --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/vect-singleton_1.c @@ -0,0 +1,38 @@ +/* PR target/59843 ICE on function taking/returning vector of one float64_t. */ + +/* { dg-do compile } */ +/* { dg-options "-Warray-bounds -O2 -fno-inline -std=c99" } */ + +#define TEST(BASETYPE, VECTYPE, SUFFIX) \ + typedef BASETYPE VECTYPE \ + __attribute__ ((__vector_size__ (sizeof (BASETYPE)))); \ + VECTYPE \ + test_vadd_##SUFFIX (VECTYPE a, VECTYPE b) \ + { \ + return a + b; \ + } \ + \ + void \ + test_##SUFFIX (BASETYPE val) \ + { \ + VECTYPE var = { val }; \ + BASETYPE v0 = var[0]; \ + BASETYPE v1 = var[1]; /* { dg-warning "index value is out of bound" } */ \ + } + +TEST (double, float64x1_t, f64) + +/* Original bug was for above type; + in a nod to completeness, test other types too. */ + +TEST (long long, int64x1_t, s64) + +TEST (float, float32x1_t, f32) + +TEST (long, longx1_t, l) + +TEST (int, intx1_t, i) + +TEST (short, int16x1_t, s16) + +TEST (char, int8x1_t, s8) diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/vect.exp b/gcc-4.9/gcc/testsuite/gcc.dg/vect/vect.exp index fa11e7e5e..e8d866b99 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/vect/vect.exp +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/vect.exp @@ -18,6 +18,7 @@ # Load support procs. load_lib gcc-dg.exp +load_lib clearcap.exp # Set up flags used for tests that don't specify options. global DEFAULT_VECTCFLAGS @@ -41,30 +42,9 @@ if ![check_vect_support_and_set_flags] { # These flags are used for all targets. lappend DEFAULT_VECTCFLAGS "-ftree-vectorize" "-fno-vect-cost-model" "-fno-common" -# If the linker used understands -M <mapfile>, pass it to clear hardware -# capabilities set by the Sun assembler. -# Try mapfile syntax v2 first which is the only way to clear hwcap_2 flags. -set clearcap_ldflags "-Wl,-M,$srcdir/gcc.target/i386/clearcapv2.map" - -if ![check_no_compiler_messages mapfilev2 executable { - int main (void) { return 0; } -} $clearcap_ldflags ] { - # If this doesn't work, fall back to the less capable v1 syntax. - set clearcap_ldflags "-Wl,-M,$srcdir/gcc.target/i386/clearcap.map" - - if ![check_no_compiler_messages mapfile executable { - int main (void) { return 0; } - } $clearcap_ldflags ] { - unset clearcap_ldflags - } -} - -if [info exists clearcap_ldflags] { - lappend DEFAULT_VECTCFLAGS $clearcap_ldflags -} - # Initialize `dg'. dg-init +clearcap-init global VEC_FLAGS set VEC_FLAGS $DEFAULT_VECTCFLAGS @@ -308,4 +288,5 @@ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-sra-bb-slp-*.\[cS\]] set dg-do-what-default ${save-dg-do-what-default} # All done. +clearcap-finish dg-finish diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/wself-assign-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/wself-assign-1.c new file mode 100644 index 000000000..19324a645 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/wself-assign-1.c @@ -0,0 +1,27 @@ +/* Test the self-assignemnt detection and warning. */ +/* { dg-do compile } */ +/* { dg-options "-Wself-assign" } */ + +struct Bar { + int b_; + int c_; +}; + +int g; + +int main() +{ + struct Bar *bar; + int x = x; /* { dg-warning "assigned to itself" } */ + static int y; + struct Bar b_array[5]; + + b_array[x+g].b_ = b_array[x+g].b_; /* { dg-warning "assigned to itself" } */ + g = g; /* { dg-warning "assigned to itself" } */ + y = y; /* { dg-warning "assigned to itself" } */ + bar->b_ = bar->b_; /* { dg-warning "assigned to itself" } */ + x += 0; /* should not warn */ + y -= 0; /* should not warn */ + x /= x; /* should not warn */ + y *= y; /* should not warn */ +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/wself-assign-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/wself-assign-2.c new file mode 100644 index 000000000..d0f69cbaf --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/wself-assign-2.c @@ -0,0 +1,24 @@ +/* Test how self-assignment detection handles constant-folding happening */ +/* when parsing the RHS or the initializer. */ +/* { dg-do compile } */ +/* { dg-options "-Wself-assign" } */ + +struct Bar { + int b_; + float c_; +}; + +int g; + +int main() +{ + struct Bar *bar; + int x = x - 0; /* should not warn */ + static int y; + struct Bar b_array[5]; + + b_array[x+g].b_ = b_array[x+g].b_ * 1; /* should no warn */ + g = g + 0; /* should not warn */ + y = y / 1; /* should not warn */ + bar->b_ = bar->b_ - 0; /* should not warn */ +} |