| 1 |
; RUN: llc -O2 -ppc-reduce-cr-logicals -print-machine-bfi -o - %s 2>&1 | FileCheck %s |
| 2 |
target datalayout = "e-m:e-i64:64-n32:64" |
| 3 |
target triple = "powerpc64le-grtev4-linux-gnu" |
| 4 |
|
| 5 |
; First block frequency info |
| 6 |
;CHECK: block-frequency-info: loop_test |
| 7 |
;CHECK-NEXT: - BB0[entry]: float = 1.0, int = {{.*}} |
| 8 |
;CHECK-NEXT: - BB1[for.check]: float = 2.6667, int = {{.*}} |
| 9 |
;CHECK-NEXT: - BB2[test1]: float = 1.6667, int = {{.*}} |
| 10 |
;CHECK-NEXT: - BB3[optional1]: float = 0.625, int = {{.*}} |
| 11 |
|
| 12 |
;CHECK: block-frequency-info: loop_test |
| 13 |
;CHECK: block-frequency-info: loop_test |
| 14 |
;CHECK: block-frequency-info: loop_test |
| 15 |
|
| 16 |
; Last block frequency info |
| 17 |
;CHECK: block-frequency-info: loop_test |
| 18 |
;CHECK-NEXT: - BB0[entry]: float = 1.0, int = {{.*}} |
| 19 |
;CHECK-NEXT: - BB1[for.check]: float = 2.6667, int = {{.*}} |
| 20 |
;CHECK-NEXT: - BB2[for.check]: float = 2.1667, int = {{.*}} |
| 21 |
;CHECK-NEXT: - BB3[test1]: float = 1.6667, int = {{.*}} |
| 22 |
;CHECK-NEXT: - BB4[optional1]: float = 0.625, int = {{.*}} |
| 23 |
|
| 24 |
|
| 25 |
define void @loop_test(ptr %tags, i32 %count) { |
| 26 |
entry: |
| 27 |
br label %for.check |
| 28 |
for.check: |
| 29 |
%count.loop = phi i32 [%count, %entry], [%count.sub, %for.latch] |
| 30 |
%done.count = icmp ugt i32 %count.loop, 0 |
| 31 |
%tag_ptr = getelementptr inbounds i32, ptr %tags, i32 %count |
| 32 |
%tag = load i32, ptr %tag_ptr |
| 33 |
%done.tag = icmp eq i32 %tag, 0 |
| 34 |
%done = and i1 %done.count, %done.tag |
| 35 |
br i1 %done, label %test1, label %exit, !prof !1 |
| 36 |
test1: |
| 37 |
%tagbit1 = and i32 %tag, 1 |
| 38 |
%tagbit1eq0 = icmp eq i32 %tagbit1, 0 |
| 39 |
br i1 %tagbit1eq0, label %test2, label %optional1, !prof !1 |
| 40 |
optional1: |
| 41 |
call void @a() |
| 42 |
call void @a() |
| 43 |
call void @a() |
| 44 |
call void @a() |
| 45 |
br label %test2 |
| 46 |
test2: |
| 47 |
%tagbit2 = and i32 %tag, 2 |
| 48 |
%tagbit2eq0 = icmp eq i32 %tagbit2, 0 |
| 49 |
br i1 %tagbit2eq0, label %test3, label %optional2, !prof !1 |
| 50 |
optional2: |
| 51 |
call void @b() |
| 52 |
call void @b() |
| 53 |
call void @b() |
| 54 |
call void @b() |
| 55 |
br label %test3 |
| 56 |
test3: |
| 57 |
%tagbit3 = and i32 %tag, 4 |
| 58 |
%tagbit3eq0 = icmp eq i32 %tagbit3, 0 |
| 59 |
br i1 %tagbit3eq0, label %test4, label %optional3, !prof !1 |
| 60 |
optional3: |
| 61 |
call void @c() |
| 62 |
call void @c() |
| 63 |
call void @c() |
| 64 |
call void @c() |
| 65 |
br label %test4 |
| 66 |
test4: |
| 67 |
%tagbit4 = and i32 %tag, 8 |
| 68 |
%tagbit4eq0 = icmp eq i32 %tagbit4, 0 |
| 69 |
br i1 %tagbit4eq0, label %for.latch, label %optional4, !prof !1 |
| 70 |
optional4: |
| 71 |
call void @d() |
| 72 |
call void @d() |
| 73 |
call void @d() |
| 74 |
call void @d() |
| 75 |
br label %for.latch |
| 76 |
for.latch: |
| 77 |
%count.sub = sub i32 %count.loop, 1 |
| 78 |
br label %for.check |
| 79 |
exit: |
| 80 |
ret void |
| 81 |
} |
| 82 |
|
| 83 |
declare void @a() |
| 84 |
declare void @b() |
| 85 |
declare void @c() |
| 86 |
declare void @d() |
| 87 |
|
| 88 |
!1 = !{!"branch_weights", i32 5, i32 3} |