brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · 67ce44e Raw
80 lines · plain
1; RUN: opt < %s -passes='print<branch-prob>' -disable-output 2>&1 | FileCheck %s2 3; In this test, the else clause is taken about 90% of the time. This was not4; reflected in the probability computation because the weight is larger than5; the branch weight cap (about 2 billion).6;7; CHECK: edge %for.body -> %if.then probability is 0x0cccba45 / 0x80000000 = 10.00%8; CHECK: edge %for.body -> %if.else probability is 0x733345bb / 0x80000000 = 90.00% [HOT edge]9 10@y = common global i64 0, align 811@x = common global i64 0, align 812@.str = private unnamed_addr constant [17 x i8] c"x = %lu\0Ay = %lu\0A\00", align 113 14; Function Attrs: inlinehint nounwind uwtable15define i32 @main() {16entry:17  %retval = alloca i32, align 418  %i = alloca i64, align 819  store i32 0, ptr %retval20  store i64 0, ptr @y, align 821  store i64 0, ptr @x, align 822  call void @srand(i32 422304)23  store i64 0, ptr %i, align 824  br label %for.cond25 26for.cond:                                         ; preds = %for.inc, %entry27  %0 = load i64, ptr %i, align 828  %cmp = icmp ult i64 %0, 1300000000029  br i1 %cmp, label %for.body, label %for.end, !prof !130 31for.body:                                         ; preds = %for.cond32  %call = call i32 @rand()33  %conv = sitofp i32 %call to double34  %mul = fmul double %conv, 1.000000e+0235  %div = fdiv double %mul, 0x41E000000000000036  %cmp1 = fcmp ogt double %div, 9.000000e+0137  br i1 %cmp1, label %if.then, label %if.else, !prof !238 39if.then:                                          ; preds = %for.body40  %1 = load i64, ptr @x, align 841  %inc = add i64 %1, 142  store i64 %inc, ptr @x, align 843  br label %if.end44 45if.else:                                          ; preds = %for.body46  %2 = load i64, ptr @y, align 847  %inc3 = add i64 %2, 148  store i64 %inc3, ptr @y, align 849  br label %if.end50 51if.end:                                           ; preds = %if.else, %if.then52  br label %for.inc53 54for.inc:                                          ; preds = %if.end55  %3 = load i64, ptr %i, align 856  %inc4 = add i64 %3, 157  store i64 %inc4, ptr %i, align 858  br label %for.cond59 60for.end:                                          ; preds = %for.cond61  %4 = load i64, ptr @x, align 862  %5 = load i64, ptr @y, align 863  %call5 = call i32 (ptr, ...) @printf(ptr @.str, i64 %4, i64 %5)64  ret i32 065}66 67; Function Attrs: nounwind68declare void @srand(i32)69 70; Function Attrs: nounwind71declare i32 @rand()72 73declare i32 @printf(ptr, ...)74 75!llvm.ident = !{!0}76 77!0 = !{!"clang version 3.7.0 (trunk 236218) (llvm/trunk 236235)"}78!1 = !{!"branch_weights", i32 -1044967295, i32 1}79!2 = !{!"branch_weights", i32 433323762, i32 -394957723}80