brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.8 KiB · 458a775 Raw
104 lines · plain
1; RUN: opt -passes=lower-expect  -S -o - < %s | FileCheck %s2; RUN: opt -S -passes='function(lower-expect)' < %s | FileCheck %s3 4define i32 @foo(i32 %arg) #0 {5; CHECK-LABEL: @foo(i32{{.*}})6bb:7  %tmp = sext i32 %arg to i648  %tmp1 = call i64 @llvm.expect.i64(i64 %tmp, i64 4)9  %tmp2 = icmp ne i64 %tmp1, 010  br i1 %tmp2, label %bb3, label %bb511; CHECK: br i1 %tmp2{{.*}}!prof [[LIKELY:![0-9]+]]12 13bb3:                                              ; preds = %bb14  %tmp4 = call i32 (...) @bar()15  br label %bb516 17bb5:                                              ; preds = %bb3, %bb18  ret i32 119}20 21define i32 @foo2(i32 %arg) #0 {22; CHECK-LABEL: @foo223bb:24  %tmp = sext i32 %arg to i6425  %tmp1 = call i64 @llvm.expect.i64(i64 %tmp, i64 4)26  %tmp2 = icmp eq i64 %tmp1, 227  br i1 %tmp2, label %bb3, label %bb528; CHECK: br i1 %tmp2{{.*}}!prof [[UNLIKELY:![0-9]+]]29 30bb3:                                              ; preds = %bb31  %tmp4 = call i32 (...) @bar()32  br label %bb533 34bb5:                                              ; preds = %bb3, %bb35  ret i32 136}37 38define i32 @foo3(i32 %arg) #0 {39; CHECK-LABEL: @foo340bb:41  %tmp = sext i32 %arg to i6442  %tmp1 = call i64 @llvm.expect.i64(i64 %tmp, i64 4)43  %tmp2 = icmp eq i64 %tmp1, 444  br i1 %tmp2, label %bb3, label %bb545; CHECK: br i1 %tmp2{{.*}}!prof [[LIKELY]]46 47bb3:                                              ; preds = %bb48  %tmp4 = call i32 (...) @bar()49  br label %bb550 51bb5:                                              ; preds = %bb3, %bb52  ret i32 153}54 55define i32 @foo4(i32 %arg) #0 {56; CHECK-LABEL: @foo457bb:58  %tmp = sext i32 %arg to i6459  %tmp1 = call i64 @llvm.expect.i64(i64 %tmp, i64 4)60  %tmp2 = icmp ne i64 %tmp1, 261  br i1 %tmp2, label %bb3, label %bb562; CHECK: br i1 %tmp2{{.*}}!prof [[LIKELY]]63 64bb3:                                              ; preds = %bb65  %tmp4 = call i32 (...) @bar()66  br label %bb567 68bb5:                                              ; preds = %bb3, %bb69  ret i32 170}71 72define i32 @foo5(i32 %arg, i32 %arg1) #0 {73; CHECK-LABEL: @foo574bb:75  %tmp = sext i32 %arg1 to i6476  %tmp2 = call i64 @llvm.expect.i64(i64 %tmp, i64 4)77  %tmp3 = sext i32 %arg to i6478  %tmp4 = icmp ne i64 %tmp2, %tmp379  br i1 %tmp4, label %bb5, label %bb780; CHECK-NOT: !prof81 82bb5:                                              ; preds = %bb83  %tmp6 = call i32 (...) @bar()84  br label %bb785 86bb7:                                              ; preds = %bb5, %bb87  ret i32 188}89 90declare i64 @llvm.expect.i64(i64, i64) #191 92declare i32 @bar(...) local_unnamed_addr #093 94attributes #0 = { nounwind uwtable }95attributes #1 = { nounwind readnone }96 97!llvm.module.flags = !{!0}98!llvm.ident = !{!1}99 100!0 = !{i32 1, !"wchar_size", i32 4}101!1 = !{!"clang version 5.0.0 (trunk 304373)"}102; CHECK: [[LIKELY]] = !{!"branch_weights", !"expected", i32 2000, i32 1}103; CHECK: [[UNLIKELY]] = !{!"branch_weights", !"expected", i32 1, i32 2000}104