f2a1229d0d8a2d1b0f74606f5aa6812ffacc9eef
[oota-llvm.git] / test / CodeGen / ARM / ifcvt-branch-weight.ll
1 ; RUN: llc < %s -mtriple=thumbv8 -print-machineinstrs=if-converter -arm-atomic-cfg-tidy=0 -o /dev/null 2>&1 | FileCheck %s
2
3 %struct.S = type { i8* (i8*)*, [1 x i8] }
4 define internal zeroext i8 @bar(%struct.S* %x, %struct.S* nocapture %y) nounwind readonly {
5 entry:
6   %0 = getelementptr inbounds %struct.S, %struct.S* %x, i32 0, i32 1, i32 0
7   %1 = load i8, i8* %0, align 1
8   %2 = zext i8 %1 to i32
9   %3 = and i32 %2, 112
10   %4 = icmp eq i32 %3, 0
11   br i1 %4, label %return, label %bb
12
13 bb:
14   %5 = getelementptr inbounds %struct.S, %struct.S* %y, i32 0, i32 1, i32 0
15   %6 = load i8, i8* %5, align 1
16   %7 = zext i8 %6 to i32
17   %8 = and i32 %7, 112
18   %9 = icmp eq i32 %8, 0
19   br i1 %9, label %return, label %bb2
20
21 ; CHECK: BB#2: derived from LLVM BB %bb2
22 ; CHECK: Successors according to CFG: BB#3(4294967289) BB#4(4294967287)
23
24 bb2:
25   %v10 = icmp eq i32 %3, 16
26   br i1 %v10, label %bb4, label %bb3, !prof !0
27
28 bb3:
29   %v11 = icmp eq i32 %8, 16
30   br i1 %v11, label %bb4, label %return, !prof !1
31
32 bb4:
33   %v12 = ptrtoint %struct.S* %x to i32
34   %phitmp = trunc i32 %v12 to i8
35   ret i8 %phitmp
36
37 return:
38   ret i8 1
39 }
40
41 !0 = !{!"branch_weights", i32 4, i32 12}
42 !1 = !{!"branch_weights", i32 8, i32 16}