diff options
-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" } } */ |