diff options
author | Jan Hubicka <jh@suse.cz> | 2020-11-25 20:52:20 +0100 |
---|---|---|
committer | Jan Hubicka <jh@suse.cz> | 2020-11-25 20:52:20 +0100 |
commit | 15f82d80cfbf834365f5819d75aaa9eeb9321224 (patch) | |
tree | 0127351f00b212d0d1f7fc388f8e68a28edfe200 /gcc | |
parent | bb07490abba850fd5b1d2d09d76d18b8bdc7d817 (diff) | |
download | gcc-15f82d80cfbf834365f5819d75aaa9eeb9321224.zip gcc-15f82d80cfbf834365f5819d75aaa9eeb9321224.tar.gz gcc-15f82d80cfbf834365f5819d75aaa9eeb9321224.tar.bz2 |
New ipa-modref testcases
gcc/testsuite/ChangeLog:
* gcc.dg/lto/modref-3_0.c: New test.
* gcc.dg/lto/modref-3_1.c: New test.
* gcc.dg/lto/modref-4_0.c: New test.
* gcc.dg/lto/modref-4_1.c: New test.
* gcc.dg/tree-ssa/modref-5.c: New test.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/gcc.dg/lto/modref-3_0.c | 17 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/lto/modref-3_1.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/lto/modref-4_0.c | 17 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/lto/modref-4_1.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/modref-5.c | 27 |
5 files changed, 87 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/lto/modref-3_0.c b/gcc/testsuite/gcc.dg/lto/modref-3_0.c new file mode 100644 index 0000000..bd8f96f --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/modref-3_0.c @@ -0,0 +1,17 @@ +/* { dg-lto-do run } */ +/* { dg-lto-options { {-O2 -flto-partition=max -fdump-ipa-modref -fno-ipa-sra -fno-ipa-cp -flto} } } */ +extern void copy (int *a, int *b); +extern void barrier (); +extern int *ptr; +int +main() +{ + int a = 1, b = 2; + copy (&a,&b); + barrier (); + *ptr = 1; + if (!__builtin_constant_p (b == 2)) + __builtin_abort (); + return 0; +} +/* { dg-final { scan-wpa-ipa-dump "parm 1 flags: nodirectescape" "modref" } } */ diff --git a/gcc/testsuite/gcc.dg/lto/modref-3_1.c b/gcc/testsuite/gcc.dg/lto/modref-3_1.c new file mode 100644 index 0000000..c36f3d1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/modref-3_1.c @@ -0,0 +1,13 @@ +__attribute__ ((noinline)) +void +copy (int *a, int *b) +{ + *a=*b; +} +int p, *ptr = &p; +__attribute__ ((noinline)) +void +barrier () +{ + asm ("":"=r"(ptr):"0"(ptr)); +} diff --git a/gcc/testsuite/gcc.dg/lto/modref-4_0.c b/gcc/testsuite/gcc.dg/lto/modref-4_0.c new file mode 100644 index 0000000..db90b4f --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/modref-4_0.c @@ -0,0 +1,17 @@ +/* { dg-lto-do run } */ +/* { dg-lto-options { {-O2 -flto-partition=max -fdump-ipa-modref -fno-ipa-sra -flto} } } */ +extern void copy (int *a, int *b); +extern void barrier (); +extern int *ptr; +int +main() +{ + int a = 1, b = 2; + copy (&a,&b); + barrier (); + *ptr = 1; + if (!__builtin_constant_p (b == 2)) + __builtin_abort (); + return 0; +} +/* { dg-final { scan-wpa-ipa-dump "parm 1 flags: nodirectescape" "modref" } } */ diff --git a/gcc/testsuite/gcc.dg/lto/modref-4_1.c b/gcc/testsuite/gcc.dg/lto/modref-4_1.c new file mode 100644 index 0000000..c36f3d1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/modref-4_1.c @@ -0,0 +1,13 @@ +__attribute__ ((noinline)) +void +copy (int *a, int *b) +{ + *a=*b; +} +int p, *ptr = &p; +__attribute__ ((noinline)) +void +barrier () +{ + asm ("":"=r"(ptr):"0"(ptr)); +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/modref-5.c b/gcc/testsuite/gcc.dg/tree-ssa/modref-5.c new file mode 100644 index 0000000..fde3177 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/modref-5.c @@ -0,0 +1,27 @@ +/* { dg-options "-O2 -fdump-tree-modref1" } */ +/* { dg-do run } */ +__attribute__ ((noinline)) +void +copy (int *a, int *b) +{ + *a=*b; +} +int p, *ptr = &p; +__attribute__ ((noinline)) +void +barrier () +{ + asm ("":"=r"(ptr):"0"(ptr)); +} +int +main() +{ + int a = 1, b = 2; + copy (&a,&b); + barrier (); + *ptr = 1; + if (!__builtin_constant_p (b == 2)) + __builtin_abort (); + return 0; +} +/* { dg-final { scan-tree-dump "parm 1 flags: nodirectescape" "modref1" } } */ |