diff options
| author | Dehao Chen <dehao@google.com> | 2016-06-14 22:27:17 +0000 |
|---|---|---|
| committer | Dehao Chen <dehao@google.com> | 2016-06-14 22:27:17 +0000 |
| commit | 9f2bdfb40fd1bd1f8f450db079e93ad86dad8b1d (patch) | |
| tree | 61f8c04e16769f35629f9a3d27a7ef91b720c90a /llvm/test/CodeGen/X86 | |
| parent | 9f3e96115ce58f97b24a292c2ce64517a99722a6 (diff) | |
| download | bcm5719-llvm-9f2bdfb40fd1bd1f8f450db079e93ad86dad8b1d.tar.gz bcm5719-llvm-9f2bdfb40fd1bd1f8f450db079e93ad86dad8b1d.zip | |
Set machine block placement hot prob threshold for both static and runtime profile.
Summary: With runtime profile, we have more confidence in branch probability, thus during basic block layout, we set a lower hot prob threshold so that blocks can be layouted optimally.
Reviewers: djasper, davidxl
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D20991
llvm-svn: 272729
Diffstat (limited to 'llvm/test/CodeGen/X86')
| -rw-r--r-- | llvm/test/CodeGen/X86/block-placement.ll | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/block-placement.ll b/llvm/test/CodeGen/X86/block-placement.ll index b83180ad509..aeea6c70417 100644 --- a/llvm/test/CodeGen/X86/block-placement.ll +++ b/llvm/test/CodeGen/X86/block-placement.ll @@ -1207,4 +1207,82 @@ exit: ret void } +define void @test_hot_branch_profile(i32* %a) !prof !6 { +; Test that a hot branch that has a probability a little larger than 60% will +; break CFG constrains when doing block placement when profile is available. +; CHECK-LABEL: test_hot_branch_profile: +; CHECK: %entry +; CHECK: %then +; CHECK: %exit +; CHECK: %else + +entry: + %gep1 = getelementptr i32, i32* %a, i32 1 + %val1 = load i32, i32* %gep1 + %cond1 = icmp ugt i32 %val1, 1 + br i1 %cond1, label %then, label %else, !prof !5 + +then: + call void @hot_function() + br label %exit + +else: + call void @cold_function() + br label %exit + +exit: + call void @hot_function() + ret void +} + +define void @test_hot_branch_triangle_profile(i32* %a) !prof !6 { +; Test that a hot branch that has a probability a little larger than 80% will +; break triangle shaped CFG constrains when doing block placement if profile +; is present. +; CHECK-LABEL: test_hot_branch_triangle_profile: +; CHECK: %entry +; CHECK: %exit +; CHECK: %then + +entry: + %gep1 = getelementptr i32, i32* %a, i32 1 + %val1 = load i32, i32* %gep1 + %cond1 = icmp ugt i32 %val1, 1 + br i1 %cond1, label %exit, label %then, !prof !5 + +then: + call void @hot_function() + br label %exit + +exit: + call void @hot_function() + ret void +} + +define void @test_hot_branch_triangle_profile_topology(i32* %a) !prof !6 { +; Test that a hot branch that has a probability between 50% and 66% will not +; break triangle shaped CFG constrains when doing block placement if profile +; is present. +; CHECK-LABEL: test_hot_branch_triangle_profile_topology: +; CHECK: %entry +; CHECK: %then +; CHECK: %exit + +entry: + %gep1 = getelementptr i32, i32* %a, i32 1 + %val1 = load i32, i32* %gep1 + %cond1 = icmp ugt i32 %val1, 1 + br i1 %cond1, label %exit, label %then, !prof !7 + +then: + call void @hot_function() + br label %exit + +exit: + call void @hot_function() + ret void +} + !5 = !{!"branch_weights", i32 84, i32 16} +!6 = !{!"function_entry_count", i32 10} +!7 = !{!"branch_weights", i32 60, i32 40} |

