From 1d9fec7937f45dde5e04cac966a2d9a12f2fc15a Mon Sep 17 00:00:00 2001 From: Yiran Wang Date: Tue, 23 Jun 2015 15:33:17 -0700 Subject: Synchronize with google/gcc-4_9 to r224707 (from r214835) Change-Id: I3d6f06fc613c8f8b6a82143dc44b7338483aac5d --- .../gcc.dg/tree-prof/cold_partition_patch.c | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/cold_partition_patch.c (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/cold_partition_patch.c') diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/cold_partition_patch.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/cold_partition_patch.c new file mode 100644 index 0000000..fe86963 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/cold_partition_patch.c @@ -0,0 +1,37 @@ +/* Check if patching works with function splitting. */ +/* { dg-require-effective-target freorder } */ +/* { dg-options "-O2 -freorder-blocks-and-partition -save-temps " { target { ! x86_64-*-* } } } +/* { dg-options "-O2 -freorder-blocks-and-partition -save-temps -mpatch-functions-for-instrumentation -fno-optimize-sibling-calls " { target x86_64-*-* } } */ +#define SIZE 10000 + +const char *sarr[SIZE]; +const char *buf_hot; +const char *buf_cold; + +__attribute__((noinline)) +void +foo (int path) +{ + int i; + if (path) + { + for (i = 0; i < SIZE; i++) + sarr[i] = buf_hot; + } + else + { + for (i = 0; i < SIZE; i++) + sarr[i] = buf_cold; + } +} + +int +main (int argc, char *argv[]) +{ + buf_hot = "hello"; + buf_cold = "world"; + foo (argc); + return 0; +} + +/* { dg-final-use { cleanup-saved-temps } } */ -- cgit v1.1