teak-llvm/clang/test/CodeGen/x86_64-instrument-functions.c
Leonard Chan b206513e45 [clang][NewPM] Move EntryExitInstrumenterPass to the start of the pipeline
This fixes CodeGen/x86_64-instrument-functions.c when running under the new
pass manager. The pass should go before any other pass to prevent
`__cyg_profile_func_enter/exit()` from not being emitted by inlined functions.

Differential Revision: https://reviews.llvm.org/D63577

llvm-svn: 363969
2019-06-20 19:35:25 +00:00

42 lines
1.5 KiB
C

// REQUIRES: x86-registered-target
// RUN: %clang_cc1 -fno-experimental-new-pass-manager -triple x86_64-unknown-unknown -S -finstrument-functions -O2 -o - %s | FileCheck %s
// 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
// RUN: %clang_cc1 -fexperimental-new-pass-manager -triple x86_64-unknown-unknown -S -finstrument-functions -O2 -o - %s | FileCheck %s
// 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
// 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
}