summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/SampleProfile
diff options
context:
space:
mode:
authorDehao Chen <dehao@google.com>2017-10-10 21:13:50 +0000
committerDehao Chen <dehao@google.com>2017-10-10 21:13:50 +0000
commit3f56a05ae57db4c4efd0717dd72aa437fb9376f9 (patch)
treefcd66a87451024613004b29e8f41e3feac5ef64a /llvm/test/Transforms/SampleProfile
parentb74063d21ff526f27c8b6601286e7748ea7624fc (diff)
downloadbcm5719-llvm-3f56a05ae57db4c4efd0717dd72aa437fb9376f9.tar.gz
bcm5719-llvm-3f56a05ae57db4c4efd0717dd72aa437fb9376f9.zip
Use the first instruction's count to estimate the funciton's entry frequency.
Summary: In the current implementation, we only have accurate profile count for standalone symbols. For inlined functions, we do not have entry count data because it's not available in LBR. In this patch, we use the first instruction's frequency to estimiate the function's entry count, especially for inlined functions. This may be inaccurate due to debug info in optimized code. However, this is a better estimate than the static 80/20 estimation we have in the current implementation. Reviewers: tejohnson, davidxl Reviewed By: tejohnson Subscribers: sanjoy, llvm-commits, aprantl Differential Revision: https://reviews.llvm.org/D38478 llvm-svn: 315369
Diffstat (limited to 'llvm/test/Transforms/SampleProfile')
-rw-r--r--llvm/test/Transforms/SampleProfile/indirect-call.ll4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SampleProfile/indirect-call.ll b/llvm/test/Transforms/SampleProfile/indirect-call.ll
index 8c80091c347..61a1bc51996 100644
--- a/llvm/test/Transforms/SampleProfile/indirect-call.ll
+++ b/llvm/test/Transforms/SampleProfile/indirect-call.ll
@@ -17,10 +17,12 @@ define void @test_inline(i64* (i32*)*, i32* %x) !dbg !6 {
store i64* (i32*)* %0, i64* (i32*)** %2
%3 = load i64* (i32*)*, i64* (i32*)** %2
; CHECK: icmp {{.*}} @foo_inline2
+; CHECK: br {{.*}} !prof ![[BR1:[0-9]+]]
; CHECK: if.true.direct_targ:
; CHECK-NOT: call
; CHECK: if.false.orig_indirect:
; CHECK: icmp {{.*}} @foo_inline1
+; CHECK: br {{.*}} !prof ![[BR2:[0-9]+]]
; CHECK: if.true.direct_targ1:
; CHECK-NOT: call
; CHECK: if.false.orig_indirect2:
@@ -178,6 +180,8 @@ define void @test_direct() !dbg !22 {
!4 = !DILocation(line: 4, scope: !3)
!5 = !DILocation(line: 6, scope: !3)
; CHECK: ![[PROF]] = !{!"VP", i32 0, i64 3457, i64 9191153033785521275, i64 2059, i64 -1069303473483922844, i64 1398}
+; CHECK: ![[BR1]] = !{!"branch_weights", i32 4000, i32 4000}
+; CHECK: ![[BR2]] = !{!"branch_weights", i32 3000, i32 1000}
; CHECK: ![[VP]] = !{!"VP", i32 0, i64 1000, i64 -6391416044382067764, i64 1000}
!6 = distinct !DISubprogram(name: "test_inline", scope: !1, file: !1, line: 6, unit: !0)
!7 = !DILocation(line: 7, scope: !6)
OpenPOWER on IntegriCloud