From a8d2d89de2ef6b87166acc81589bdbb622917705 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sat, 26 Sep 2020 10:44:53 +0200 Subject: [PATCH] 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. --- gcc/testsuite/gcc.dg/lto/modref-1_0.c | 14 +++++++++++++ gcc/testsuite/gcc.dg/lto/modref-1_1.c | 13 ++++++++++++ gcc/testsuite/gcc.dg/tree-ssa/modref-2.c | 26 ++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/lto/modref-1_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/modref-1_1.c create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/modref-2.c 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 00000000000..8fcb9ec52f1 --- /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 00000000000..c7c0eaec971 --- /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 00000000000..9999d37369d --- /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; +} -- 2.30.2