1; RUN: llc -march=hexagon < %s | FileCheck %s
2
3; CHECK: cmp.eq
4; CHECK: cmp.eq
5; CHECK: cmp.eq
6; CHECK: cmp.eq
7
8%s.0 = type { i8*, i32, %s.0* }
9
10@g0 = external global %s.0**, align 4
11@g1 = private global [4 x i64] zeroinitializer, section "__llvm_prf_cnts", align 8
12
13declare void @f0(%s.0*)
14
15define i32 @f1() #0 {
16b0:
17  %v0 = load i64, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @g1, i32 0, i32 0), align 8
18  %v1 = add i64 %v0, 1
19  store i64 %v1, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @g1, i32 0, i32 0), align 8
20  br label %b1
21
22b1:                                               ; preds = %b6, %b0
23  %v2 = phi i32 [ 0, %b0 ], [ %v27, %b6 ]
24  %v3 = load i64, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @g1, i32 0, i32 1), align 8
25  %v4 = add i64 %v3, 1
26  store i64 %v4, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @g1, i32 0, i32 1), align 8
27  %v5 = load %s.0**, %s.0*** @g0, align 4
28  %v6 = getelementptr inbounds %s.0*, %s.0** %v5, i32 %v2
29  %v7 = load %s.0*, %s.0** %v6, align 4
30  %v8 = icmp eq %s.0* %v7, null
31  br i1 %v8, label %b6, label %b2
32
33b2:                                               ; preds = %b1
34  %v9 = load i64, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @g1, i32 0, i32 2), align 8
35  %v10 = add i64 %v9, 1
36  store i64 %v10, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @g1, i32 0, i32 2), align 8
37  %v11 = bitcast %s.0* %v7 to %s.0*
38  %v12 = getelementptr inbounds %s.0, %s.0* %v11, i32 0, i32 2
39  %v13 = load %s.0*, %s.0** %v12, align 4
40  %v14 = icmp eq %s.0* %v13, null
41  %v15 = getelementptr inbounds %s.0, %s.0* %v11, i32 0, i32 2
42  br i1 %v14, label %b5, label %b3
43
44b3:                                               ; preds = %b2
45  br label %b4
46
47b4:                                               ; preds = %b4, %b3
48  %v16 = phi %s.0** [ %v25, %b4 ], [ %v15, %b3 ]
49  %v17 = phi %s.0* [ %v20, %b4 ], [ %v7, %b3 ]
50  %v18 = load i64, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @g1, i32 0, i32 3), align 8
51  %v19 = add i64 %v18, 1
52  store i64 %v19, i64* getelementptr inbounds ([4 x i64], [4 x i64]* @g1, i32 0, i32 3), align 8
53  %v20 = load %s.0*, %s.0** %v16, align 4
54  tail call void @f0(%s.0* %v17)
55  %v21 = bitcast %s.0* %v20 to %s.0*
56  %v22 = getelementptr inbounds %s.0, %s.0* %v21, i32 0, i32 2
57  %v23 = load %s.0*, %s.0** %v22, align 4
58  %v24 = icmp eq %s.0* %v23, null
59  %v25 = getelementptr inbounds %s.0, %s.0* %v21, i32 0, i32 2
60  br i1 %v24, label %b5, label %b4
61
62b5:                                               ; preds = %b4, %b2
63  %v26 = phi %s.0* [ %v7, %b2 ], [ %v20, %b4 ]
64  tail call void @f0(%s.0* %v26)
65  br label %b6
66
67b6:                                               ; preds = %b5, %b1
68  %v27 = add nuw nsw i32 %v2, 1
69  %v28 = icmp eq i32 %v27, 3001
70  br i1 %v28, label %b7, label %b1
71
72b7:                                               ; preds = %b6
73  %v29 = load %s.0*, %s.0** bitcast (%s.0*** @g0 to %s.0**), align 4
74  tail call void @f0(%s.0* %v29)
75  ret i32 undef
76}
77
78attributes #0 = { nounwind "target-cpu"="hexagonv60" }
79
80