diff options
Diffstat (limited to 'clang/test/CodeGen')
-rw-r--r-- | clang/test/CodeGen/instrument-functions.c | 17 | ||||
-rw-r--r-- | clang/test/CodeGen/mcount.c | 8 | ||||
-rw-r--r-- | clang/test/CodeGen/x86_64-instrument-functions.c | 38 |
3 files changed, 52 insertions, 11 deletions
diff --git a/clang/test/CodeGen/instrument-functions.c b/clang/test/CodeGen/instrument-functions.c index 454dc4de522..d3f043628bf 100644 --- a/clang/test/CodeGen/instrument-functions.c +++ b/clang/test/CodeGen/instrument-functions.c @@ -1,18 +1,21 @@ -// RUN: %clang_cc1 -S -debug-info-kind=standalone -emit-llvm -o - %s -finstrument-functions | FileCheck %s +// RUN: %clang_cc1 -S -debug-info-kind=standalone -emit-llvm -o - %s -finstrument-functions -disable-llvm-passes | FileCheck %s -// CHECK: @test1 int test1(int x) { -// CHECK: call void @__cyg_profile_func_enter({{.*}}, !dbg -// CHECK: call void @__cyg_profile_func_exit({{.*}}, !dbg +// CHECK: define i32 @test1(i32 %x) #[[ATTR1:[0-9]+]] // CHECK: ret return x; } -// CHECK: @test2 int test2(int) __attribute__((no_instrument_function)); int test2(int x) { -// CHECK-NOT: __cyg_profile_func_enter -// CHECK-NOT: __cyg_profile_func_exit +// CHECK: define i32 @test2(i32 %x) #[[ATTR2:[0-9]+]] // CHECK: ret return x; } + +// CHECK: attributes #[[ATTR1]] = +// CHECK-SAME: "instrument-function-entry"="__cyg_profile_func_enter" +// CHECK-SAME: "instrument-function-exit"="__cyg_profile_func_exit" + +// CHECK: attributes #[[ATTR2]] = +// CHECK-NOT: "instrument-function-entry" diff --git a/clang/test/CodeGen/mcount.c b/clang/test/CodeGen/mcount.c index 2284acac0f8..98a2a6b3909 100644 --- a/clang/test/CodeGen/mcount.c +++ b/clang/test/CodeGen/mcount.c @@ -35,9 +35,9 @@ int main(void) { return no_instrument(); } -// CHECK: attributes #0 = { {{.*}}"counting-function"="mcount"{{.*}} } +// CHECK: attributes #0 = { {{.*}}"instrument-function-entry-inlined"="mcount"{{.*}} } // CHECK: attributes #1 = { {{.*}} } -// CHECK-PREFIXED: attributes #0 = { {{.*}}"counting-function"="_mcount"{{.*}} } +// CHECK-PREFIXED: attributes #0 = { {{.*}}"instrument-function-entry-inlined"="_mcount"{{.*}} } // CHECK-PREFIXED: attributes #1 = { {{.*}} } -// NO-MCOUNT-NOT: attributes #{{[0-9]}} = { {{.*}}"counting-function"={{.*}} } -// NO-MCOUNT1-NOT: attributes #1 = { {{.*}}"counting-function"={{.*}} } +// NO-MCOUNT-NOT: attributes #{{[0-9]}} = { {{.*}}"instrument-function-entry-inlined"={{.*}} } +// NO-MCOUNT1-NOT: attributes #1 = { {{.*}}"instrument-function-entry-inlined"={{.*}} } diff --git a/clang/test/CodeGen/x86_64-instrument-functions.c b/clang/test/CodeGen/x86_64-instrument-functions.c new file mode 100644 index 00000000000..686d9aa14ca --- /dev/null +++ b/clang/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 +} |