diff options
| author | Bob Wilson <bob.wilson@apple.com> | 2014-03-06 04:55:41 +0000 |
|---|---|---|
| committer | Bob Wilson <bob.wilson@apple.com> | 2014-03-06 04:55:41 +0000 |
| commit | da1ebedeea4314d92e6688da36f0e6ea66eb3dd6 (patch) | |
| tree | a45063de92e7b5423aa7cb48c7b99643d6c25dac /clang/test/CodeGen/instr-profile.c | |
| parent | d0b7824ece029ca267adf55336ea9ace04b4b32f (diff) | |
| download | bcm5719-llvm-da1ebedeea4314d92e6688da36f0e6ea66eb3dd6.tar.gz bcm5719-llvm-da1ebedeea4314d92e6688da36f0e6ea66eb3dd6.zip | |
PGO: Use the main file name to help distinguish functions with local linkage.
In addition, for all functions, use the name from the llvm::Function to
identify the function in the profile data. Compute that "function name",
including the file name for local functions, once when assigning the PGO
counters and store it in the CodeGenPGO class.
Move the code to add InlineHint and Cold attributes out of StartFunction(),
because the "function name" string isn't available at that point.
llvm-svn: 203075
Diffstat (limited to 'clang/test/CodeGen/instr-profile.c')
| -rw-r--r-- | clang/test/CodeGen/instr-profile.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/CodeGen/instr-profile.c b/clang/test/CodeGen/instr-profile.c index c982dcb7582..f753f8306d4 100644 --- a/clang/test/CodeGen/instr-profile.c +++ b/clang/test/CodeGen/instr-profile.c @@ -18,6 +18,7 @@ // PGOGEN: @[[BLC:__llvm_pgo_ctr[0-9]*]] = private global [9 x i64] zeroinitializer // PGOGEN: @[[NOC:__llvm_pgo_ctr[0-9]*]] = private global [2 x i64] zeroinitializer // PGOGEN: @[[MAC:__llvm_pgo_ctr[0-9]*]] = private global [1 x i64] zeroinitializer +// PGOGEN: @[[STF:__llvm_pgo_ctr[0-9]*]] = private global [2 x i64] zeroinitializer // PGOGEN-LABEL: @simple_loops() // PGOUSE-LABEL: @simple_loops() @@ -445,6 +446,16 @@ void no_usable_data() { // PGOUSE-NOT: br {{.*}} !prof ![0-9]+ } +// PGOGEN-LABEL: @static_func() +// PGOUSE-LABEL: @static_func() +// PGOGEN: store {{.*}} @[[STF]], i64 0, i64 0 +static void static_func() { + // PGOGEN: store {{.*}} @[[STF]], i64 0, i64 1 + // PGOUSE: br {{.*}} !prof ![[ST1:[0-9]+]] + for (int i = 0; i < 10; ++i) { + } +} + // PGOUSE-DAG: ![[SL1]] = metadata !{metadata !"branch_weights", i32 101, i32 2} // PGOUSE-DAG: ![[SL2]] = metadata !{metadata !"branch_weights", i32 101, i32 2} // PGOUSE-DAG: ![[SL3]] = metadata !{metadata !"branch_weights", i32 76, i32 2} @@ -513,6 +524,7 @@ void no_usable_data() { // PGOUSE-DAG: ![[BL6]] = metadata !{metadata !"branch_weights", i32 51, i32 2} // PGOUSE-DAG: ![[BL7]] = metadata !{metadata !"branch_weights", i32 26, i32 27} // PGOUSE-DAG: ![[BL8]] = metadata !{metadata !"branch_weights", i32 51, i32 2} +// PGOUSE-DAG: ![[ST1]] = metadata !{metadata !"branch_weights", i32 11, i32 2} int main(int argc, const char *argv[]) { simple_loops(); @@ -525,5 +537,6 @@ int main(int argc, const char *argv[]) { boolop_loops(); do_fallthrough(); no_usable_data(); + static_func(); return 0; } |

