From: Jan Hubicka Date: Sat, 26 Sep 2020 08:44:53 +0000 (+0200) Subject: Add modref testcases X-Git-Tag: upstream/12.2.0~13475 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a8d2d89de2ef6b87166acc81589bdbb622917705;p=platform%2Fupstream%2Fgcc.git Add modref testcases gcc/testsuite/ * gcc.dg/lto/modref-1_0.c: New test. * gcc.dg/lto/modref-1_1.c: New test. * gcc.dg/tree-ssa/modref-2.c: New test. --- diff --git a/gcc/testsuite/gcc.dg/lto/modref-1_0.c b/gcc/testsuite/gcc.dg/lto/modref-1_0.c new file mode 100644 index 0000000..8fcb9ec --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/modref-1_0.c @@ -0,0 +1,14 @@ +/* { dg-lto-do run } */ +/* { dg-lto-options {"-O2 -flto-partition=max -flto"} } */ +extern void recursive (int *a, int *b, int *c, int level); +int +main() +{ + int x = 123, y=124, z=125; + recursive (&x,&y,&z,1); + if (y) + __builtin_abort (); + if (!__builtin_constant_p (z)) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/modref-1_1.c b/gcc/testsuite/gcc.dg/lto/modref-1_1.c new file mode 100644 index 0000000..c7c0eae --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/modref-1_1.c @@ -0,0 +1,13 @@ +short aa; +void +__attribute__ ((noinline, noclone)) +recursive (int *a, int *b, int *c, int level) +{ + if (level && c) + { + recursive (b,a,c,0); + aa++; + } + else + *a=0; +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/modref-2.c b/gcc/testsuite/gcc.dg/tree-ssa/modref-2.c new file mode 100644 index 0000000..9999d37 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/modref-2.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ +short aa; +void +__attribute__ ((noinline, noclone)) +recursive (int *a, int *b, int *c, int level) +{ + if (level && c) + { + recursive (b,a,c,0); + aa++; + } + else + *a=0; +} +int +main() +{ + int x = 123, y=124, z=125; + recursive (&x,&y,&z,1); + if (y) + __builtin_abort (); + if (!__builtin_constant_p (z)) + __builtin_abort (); + return 0; +}