1 // REQUIRES: x86-registered-target
2 // RUN: %clang_cc1 -fno-experimental-new-pass-manager -triple x86_64-unknown-unknown -S -finstrument-functions -O2 -o - %s | FileCheck %s
3 // RUN: %clang_cc1 -fno-experimental-new-pass-manager -triple x86_64-unknown-unknown -S -finstrument-functions-after-inlining -O2 -o - %s | FileCheck -check-prefix=NOINLINE %s
4 
5 // RUN: %clang_cc1 -fexperimental-new-pass-manager -triple x86_64-unknown-unknown -S -finstrument-functions -O2 -o - %s | FileCheck %s
6 // RUN: %clang_cc1 -fexperimental-new-pass-manager -triple x86_64-unknown-unknown -S -finstrument-functions-after-inlining -O2 -o - %s | FileCheck -check-prefix=NOINLINE %s
7 
8 // It's not so nice having asm tests in Clang, but we need to check that we set
9 // up the pipeline correctly in order to have the instrumentation inserted.
10 
leaf(int x)11 int leaf(int x) {
12   return x;
13 // CHECK-LABEL: leaf:
14 // CHECK: callq __cyg_profile_func_enter
15 // CHECK-NOT: cyg_profile
16 // CHECK: callq __cyg_profile_func_exit
17 // CHECK-NOT: cyg_profile
18 // CHECK: ret
19 }
20 
root(int x)21 int root(int x) {
22   return leaf(x);
23 // CHECK-LABEL: root:
24 // CHECK: callq __cyg_profile_func_enter
25 // CHECK-NOT: cyg_profile
26 
27 // Inlined from leaf():
28 // CHECK: callq __cyg_profile_func_enter
29 // CHECK-NOT: cyg_profile
30 // CHECK: callq __cyg_profile_func_exit
31 
32 // CHECK-NOT: cyg_profile
33 // CHECK: callq __cyg_profile_func_exit
34 // CHECK: ret
35 
36 // NOINLINE-LABEL: root:
37 // NOINLINE: callq __cyg_profile_func_enter
38 // NOINLINE-NOT: cyg_profile
39 // NOINLINE: callq __cyg_profile_func_exit
40 // NOINLINE: ret
41 }
42