mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-26 07:18:15 +00:00
Allow 0-weight branches in BranchProbabilityInfo.
Summary: When computing branch weights in BPI, we used to disallow branches with weight 0. This is a minor nuisance, because a branch with weight 0 is different to "don't have information". In the context of instrumentation, it may mean "never executed", in the context of sampling, it means "never or seldom executed". In allowing 0 weight branches, I ran into issues with the switch expansion code in selection DAG. It is currently hardwired to not handle branches with weight 0. To maintain the current behaviour, I changed it to use 1 when it finds 0, but perhaps the algorithm needs changes to tolerate branches with weight zero. Reviewers: hansw Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9533 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236617 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -73,8 +73,8 @@ for.cond: ; preds = %for.inc16, %if.else
|
||||
%5 = load i64, i64* %N.addr, align 8, !dbg !15
|
||||
%cmp1 = icmp slt i64 %4, %5, !dbg !15
|
||||
br i1 %cmp1, label %for.body, label %for.end18, !dbg !15
|
||||
; CHECK: edge for.cond -> for.body probability is 10 / 11 = 90.9091% [HOT edge]
|
||||
; CHECK: edge for.cond -> for.end18 probability is 1 / 11 = 9.09091%
|
||||
; CHECK: edge for.cond -> for.body probability is 10 / 10 = 100% [HOT edge]
|
||||
; CHECK: edge for.cond -> for.end18 probability is 0 / 10 = 0%
|
||||
|
||||
for.body: ; preds = %for.cond
|
||||
%6 = load i64, i64* %i, align 8, !dbg !18
|
||||
@@ -119,8 +119,8 @@ for.cond8: ; preds = %for.inc, %if.else7
|
||||
%14 = load i64, i64* %i, align 8, !dbg !28
|
||||
%cmp10 = icmp slt i64 %conv9, %14, !dbg !28
|
||||
br i1 %cmp10, label %for.body11, label %for.end, !dbg !28
|
||||
; CHECK: edge for.cond8 -> for.body11 probability is 16191 / 16192 = 99.9938% [HOT edge]
|
||||
; CHECK: edge for.cond8 -> for.end probability is 1 / 16192 = 0.00617589%
|
||||
; CHECK: edge for.cond8 -> for.body11 probability is 16191 / 16191 = 100% [HOT edge]
|
||||
; CHECK: edge for.cond8 -> for.end probability is 0 / 16191 = 0%
|
||||
|
||||
for.body11: ; preds = %for.cond8
|
||||
%15 = load i32, i32* %j, align 4, !dbg !31
|
||||
|
||||
Reference in New Issue
Block a user