diff options
Diffstat (limited to 'test/CodeGen/x86_64-instrument-functions.c')
-rw-r--r-- | test/CodeGen/x86_64-instrument-functions.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/CodeGen/x86_64-instrument-functions.c b/test/CodeGen/x86_64-instrument-functions.c new file mode 100644 index 000000000000..686d9aa14ca7 --- /dev/null +++ b/test/CodeGen/x86_64-instrument-functions.c @@ -0,0 +1,38 @@ +// REQUIRES: x86-registered-target +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -finstrument-functions -O2 -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -finstrument-functions-after-inlining -O2 -o - %s | FileCheck -check-prefix=NOINLINE %s + +// It's not so nice having asm tests in Clang, but we need to check that we set +// up the pipeline correctly in order to have the instrumentation inserted. + +int leaf(int x) { + return x; +// CHECK-LABEL: leaf: +// CHECK: callq __cyg_profile_func_enter +// CHECK-NOT: cyg_profile +// CHECK: callq __cyg_profile_func_exit +// CHECK-NOT: cyg_profile +// CHECK: ret +} + +int root(int x) { + return leaf(x); +// CHECK-LABEL: root: +// CHECK: callq __cyg_profile_func_enter +// CHECK-NOT: cyg_profile + +// Inlined from leaf(): +// CHECK: callq __cyg_profile_func_enter +// CHECK-NOT: cyg_profile +// CHECK: callq __cyg_profile_func_exit + +// CHECK-NOT: cyg_profile +// CHECK: callq __cyg_profile_func_exit +// CHECK: ret + +// NOINLINE-LABEL: root: +// NOINLINE: callq __cyg_profile_func_enter +// NOINLINE-NOT: cyg_profile +// NOINLINE: callq __cyg_profile_func_exit +// NOINLINE: ret +} |