diff options
author | Hans Wennborg <hans@hanshq.net> | 2017-11-14 21:13:27 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2017-11-14 21:13:27 +0000 |
commit | 12f3fe3bbd9e79d5623c39abd95e5ddc880fcb6d (patch) | |
tree | 50de85bc7f3aff6e0c69b68e1d2c6161a5cac69e /test/CodeGen/x86_64-instrument-functions.c | |
parent | 4944bbc9c268ace61e9e02ce8e58352ef19c8a2a (diff) | |
download | clang-12f3fe3bbd9e79d5623c39abd95e5ddc880fcb6d.tar.gz |
Switch -mcount and -finstrument-functions to emit EnterExitInstrumenter attributes
This updates -mcount to use the new attribute names (LLVM r318195), and
switches over -finstrument-functions to also use these attributes rather
than inserting instrumentation in the frontend.
It also adds a new flag, -finstrument-functions-after-inlining, which
makes the cygprofile instrumentation get inserted after inlining rather
than before.
Differential Revision: https://reviews.llvm.org/D39331
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318199 91177308-0d34-0410-b5e6-96231b3b80d8
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 0000000000..686d9aa14c --- /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 +} |