summaryrefslogtreecommitdiff
path: root/test/Transforms/SampleProfile
diff options
context:
space:
mode:
authorDehao Chen <dehao@google.com>2016-09-19 16:33:41 +0000
committerDehao Chen <dehao@google.com>2016-09-19 16:33:41 +0000
commitba3d957955dcba7a35eda72c6bb301bdf753a482 (patch)
tree9c369b07664f3325c8ffa8c3f8032de10ca6ca4d /test/Transforms/SampleProfile
parent625183db5aefe31deffea186e4cf6e85b2861edb (diff)
Only set branch weight during sample pgo annotation when max_weight of the branch is non-zero. Otherwise use default static profile to set branch probability.
Summary: It does not make sense to set equal weights for all unkown branches as we have static branch prediction available. Reviewers: dnovillo Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D24732 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281912 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/SampleProfile')
-rw-r--r--test/Transforms/SampleProfile/fnptr.ll13
1 files changed, 5 insertions, 8 deletions
diff --git a/test/Transforms/SampleProfile/fnptr.ll b/test/Transforms/SampleProfile/fnptr.ll
index 5359eee831f..f9a08a39550 100644
--- a/test/Transforms/SampleProfile/fnptr.ll
+++ b/test/Transforms/SampleProfile/fnptr.ll
@@ -12,8 +12,8 @@
; CHECK: edge for.body3 -> if.else probability is 0x65a95a96 / 0x80000000 = 79.42%
; CHECK: edge for.inc -> for.inc12 probability is 0x000fdc50 / 0x80000000 = 0.05%
; CHECK: edge for.inc -> for.body3 probability is 0x7ff023b0 / 0x80000000 = 99.95%
-; CHECK: edge for.inc12 -> for.end14 probability is 0x40000000 / 0x80000000 = 50.00%
-; CHECK: edge for.inc12 -> for.cond1.preheader probability is 0x40000000 / 0x80000000 = 50.00%
+; CHECK: edge for.inc12 -> for.end14 probability is 0x04000000 / 0x80000000 = 3.12%
+; CHECK: edge for.inc12 -> for.cond1.preheader probability is 0x7c000000 / 0x80000000 = 96.88%
; Original C++ test case.
;
@@ -88,7 +88,7 @@ for.body3: ; preds = %for.inc, %for.cond1
%call5 = tail call i32 @rand() #3, !dbg !16
%rem6 = srem i32 %call5, 100, !dbg !16
%cmp7 = icmp slt i32 %rem6, 10, !dbg !16
- br i1 %cmp7, label %if.then, label %if.else, !dbg !16, !prof !17
+ br i1 %cmp7, label %if.then, label %if.else, !dbg !16
if.then: ; preds = %for.body3
%mul = mul nsw i32 %j.023, 300, !dbg !18
@@ -107,13 +107,13 @@ for.inc: ; preds = %if.then, %if.else
%S.2 = fadd double %S.122, %call8.pn, !dbg !18
%inc = add nsw i32 %j.023, 1, !dbg !20
%exitcond = icmp eq i32 %j.023, 5999, !dbg !14
- br i1 %exitcond, label %for.inc12, label %for.body3, !dbg !14, !prof !21
+ br i1 %exitcond, label %for.inc12, label %for.body3, !dbg !14
for.inc12: ; preds = %for.inc
%S.2.lcssa = phi double [ %S.2, %for.inc ]
%inc13 = add nsw i32 %i.025, 1, !dbg !22
%exitcond26 = icmp eq i32 %i.025, 9999, !dbg !12
- br i1 %exitcond26, label %for.end14, label %for.cond1.preheader, !dbg !12, !prof !23
+ br i1 %exitcond26, label %for.end14, label %for.cond1.preheader, !dbg !12
for.end14: ; preds = %for.inc12
%S.2.lcssa.lcssa = phi double [ %S.2.lcssa, %for.inc12 ]
@@ -148,13 +148,10 @@ declare i32 @printf(i8* nocapture readonly, ...) #1
!14 = !DILocation(line: 20, column: 5, scope: !13)
!15 = !DILocation(line: 21, column: 15, scope: !13)
!16 = !DILocation(line: 22, column: 11, scope: !13)
-!17 = !{!"branch_weights", i32 534, i32 2064}
!18 = !DILocation(line: 23, column: 14, scope: !13)
!19 = !DILocation(line: 25, column: 14, scope: !13)
!20 = !DILocation(line: 20, column: 28, scope: !13)
-!21 = !{!"branch_weights", i32 0, i32 1075}
!22 = !DILocation(line: 19, column: 26, scope: !13)
-!23 = !{!"branch_weights", i32 0, i32 534}
!24 = !DILocation(line: 27, column: 3, scope: !13)
!25 = !DILocation(line: 28, column: 3, scope: !13)
!26 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5 ", isOptimized: false, emissionKind: FullDebug, file: !4)