Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch -mcount and -finstrument-functions to emit EnterExitInstrument…
…er 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 llvm-svn: 318199
- Loading branch information
Showing
11 changed files
with
121 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters