diff options
author | Dehao Chen <dehao@google.com> | 2017-03-23 23:14:11 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2017-03-23 23:14:11 +0000 |
commit | 775341a14ca7dc940a0e66fb637ec47fc7d86337 (patch) | |
tree | d71ef3a3c9fb77342087cf18d84b96dc154dacc9 /llvm/test/Transforms/CodeGenPrepare/section.ll | |
parent | 10fbac009d007fc11c92a5dc5b2fbf07781fd139 (diff) | |
download | bcm5719-llvm-775341a14ca7dc940a0e66fb637ec47fc7d86337.tar.gz bcm5719-llvm-775341a14ca7dc940a0e66fb637ec47fc7d86337.zip |
Use isFunctionHotInCallGraph to set the function section prefix.
Summary: The current prefix based function layout algorithm only looks at function's entry count, which is not sufficient. A function should be grouped together if its entry count or any call edge count is hot.
Reviewers: davidxl, eraman
Reviewed By: eraman
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D31225
llvm-svn: 298656
Diffstat (limited to 'llvm/test/Transforms/CodeGenPrepare/section.ll')
-rw-r--r-- | llvm/test/Transforms/CodeGenPrepare/section.ll | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/Transforms/CodeGenPrepare/section.ll b/llvm/test/Transforms/CodeGenPrepare/section.ll index 795c45c220d..2c96612e1ba 100644 --- a/llvm/test/Transforms/CodeGenPrepare/section.ll +++ b/llvm/test/Transforms/CodeGenPrepare/section.ll @@ -5,12 +5,32 @@ target triple = "x86_64-pc-linux-gnu" ; This tests that hot/cold functions get correct section prefix assigned ; CHECK: hot_func{{.*}}!section_prefix ![[HOT_ID:[0-9]+]] +; The entry is hot define void @hot_func() !prof !15 { ret void } +; CHECK: hot_call_func{{.*}}!section_prefix ![[HOT_ID]] +; The sum of 2 callsites are hot +define void @hot_call_func() !prof !16 { + call void @hot_func(), !prof !17 + call void @hot_func(), !prof !17 + ret void +} + +; CHECK-NOT: normal_func{{.*}}!section_prefix +; The sum of all callsites are neither hot or cold +define void @normal_func() !prof !16 { + call void @hot_func(), !prof !17 + call void @hot_func(), !prof !18 + call void @hot_func(), !prof !18 + ret void +} + ; CHECK: cold_func{{.*}}!section_prefix ![[COLD_ID:[0-9]+]] +; The entry and the callsite are both cold define void @cold_func() !prof !16 { + call void @hot_func(), !prof !18 ret void } @@ -33,3 +53,5 @@ define void @cold_func() !prof !16 { !14 = !{i32 999999, i64 1, i32 2} !15 = !{!"function_entry_count", i64 1000} !16 = !{!"function_entry_count", i64 1} +!17 = !{!"branch_weights", i32 80} +!18 = !{!"branch_weights", i32 1} |