From: Jan Hubicka Date: Wed, 25 Nov 2020 19:52:20 +0000 (+0100) Subject: New ipa-modref testcases X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=15f82d80cfbf834365f5819d75aaa9eeb9321224;p=gcc.git 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. --- 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 00000000000..bd8f96f6ec4 --- /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 00000000000..c36f3d1b482 --- /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 00000000000..db90b4f1f3d --- /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 00000000000..c36f3d1b482 --- /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 00000000000..fde31772862 --- /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" } } */