mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
Make the unreachable probability much much heavier. The previous
probability wouldn't be considered "hot" in some weird loop structures or other compounding probability patterns. This makes it much harder to confuse, but isn't really a principled fix. I'd actually like it if we could model a zero probability, as it would make this much easier to reason about. Suggestions for how to do this better are welcome. llvm-svn: 147142
This commit is contained in:
parent
fc4563fd8c
commit
acdf352b77
@ -65,8 +65,9 @@ static const uint32_t UR_TAKEN_WEIGHT = 1;
|
||||
///
|
||||
/// This is the weight for a branch not being taken toward a block that
|
||||
/// terminates (eventually) in unreachable. Such a branch is essentially never
|
||||
/// taken.
|
||||
static const uint32_t UR_NONTAKEN_WEIGHT = 1023;
|
||||
/// taken. Set the weight to an absurdly high value so that nested loops don't
|
||||
/// easily subsume it.
|
||||
static const uint32_t UR_NONTAKEN_WEIGHT = 1024*1024 - 1;
|
||||
|
||||
static const uint32_t PH_TAKEN_WEIGHT = 20;
|
||||
static const uint32_t PH_NONTAKEN_WEIGHT = 12;
|
||||
|
@ -8,8 +8,8 @@ define i32 @test1(i32 %a, i32 %b) {
|
||||
entry:
|
||||
%cond = icmp eq i32 %a, 42
|
||||
br i1 %cond, label %exit, label %abort
|
||||
; CHECK: edge entry -> exit probability is 1023 / 1024
|
||||
; CHECK: edge entry -> abort probability is 1 / 1024
|
||||
; CHECK: edge entry -> exit probability is 1048575 / 1048576
|
||||
; CHECK: edge entry -> abort probability is 1 / 1048576
|
||||
|
||||
abort:
|
||||
call void @abort() noreturn
|
||||
@ -26,11 +26,11 @@ entry:
|
||||
i32 2, label %case_b
|
||||
i32 3, label %case_c
|
||||
i32 4, label %case_d]
|
||||
; CHECK: edge entry -> exit probability is 1023 / 1027
|
||||
; CHECK: edge entry -> case_a probability is 1 / 1027
|
||||
; CHECK: edge entry -> case_b probability is 1 / 1027
|
||||
; CHECK: edge entry -> case_c probability is 1 / 1027
|
||||
; CHECK: edge entry -> case_d probability is 1 / 1027
|
||||
; CHECK: edge entry -> exit probability is 1048575 / 1048579
|
||||
; CHECK: edge entry -> case_a probability is 1 / 1048579
|
||||
; CHECK: edge entry -> case_b probability is 1 / 1048579
|
||||
; CHECK: edge entry -> case_c probability is 1 / 1048579
|
||||
; CHECK: edge entry -> case_d probability is 1 / 1048579
|
||||
|
||||
case_a:
|
||||
br label %case_b
|
||||
@ -55,8 +55,8 @@ define i32 @test3(i32 %a, i32 %b) {
|
||||
entry:
|
||||
%cond1 = icmp eq i32 %a, 42
|
||||
br i1 %cond1, label %exit, label %dom
|
||||
; CHECK: edge entry -> exit probability is 1023 / 1024
|
||||
; CHECK: edge entry -> dom probability is 1 / 1024
|
||||
; CHECK: edge entry -> exit probability is 1048575 / 1048576
|
||||
; CHECK: edge entry -> dom probability is 1 / 1048576
|
||||
|
||||
dom:
|
||||
%cond2 = icmp ult i32 %a, 42
|
||||
|
Loading…
Reference in New Issue
Block a user