1; RUN: llc  -march=hexagon -function-sections < %s | FileCheck %s
2; CHECK: if (!p0)
3; CHECK-NOT: if (p0.new)
4; CHECK: {
5
6target triple = "hexagon-unknown--elf"
7
8%s.0 = type { i8*, i8* }
9%s.1 = type { i8, [2 x %s.2*] }
10%s.2 = type { i32, i32 }
11
12@g0 = internal constant %s.0 zeroinitializer, align 4
13
14; Function Attrs: minsize nounwind
15define i32 @f0(%s.1* %a0) #0 {
16b0:
17  %v0 = tail call i32 @f1(%s.1* %a0, i32 0)
18  ret i32 %v0
19}
20
21; Function Attrs: minsize nounwind
22define internal i32 @f1(%s.1* %a0, i32 %a1) #0 {
23b0:
24  %v0 = icmp eq %s.1* %a0, null
25  br i1 %v0, label %b4, label %b1
26
27b1:                                               ; preds = %b0
28  %v1 = icmp eq i32 %a1, 1
29  br i1 %v1, label %b3, label %b2
30
31b2:                                               ; preds = %b1
32  tail call void @f2(%s.0* null) #3
33  unreachable
34
35b3:                                               ; preds = %b1
36  tail call void @f2(%s.0* @g0) #3
37  unreachable
38
39b4:                                               ; preds = %b0
40  %v2 = load %s.2*, %s.2** inttoptr (i32 4 to %s.2**), align 4, !tbaa !0
41  %v3 = icmp eq %s.2* %v2, null
42  br i1 %v3, label %b5, label %b6
43
44b5:                                               ; preds = %b4
45  tail call void @f3(i32 0) #4
46  br label %b10
47
48b6:                                               ; preds = %b4
49  %v4 = tail call zeroext i8 @f4(%s.1* null) #4
50  %v5 = icmp eq i8 %v4, 0
51  br i1 %v5, label %b7, label %b8
52
53b7:                                               ; preds = %b6
54  tail call void @f3(i32 0) #4
55  br label %b9
56
57b8:                                               ; preds = %b6
58  %v6 = load %s.2*, %s.2** inttoptr (i32 4 to %s.2**), align 4, !tbaa !0
59  %v7 = icmp eq i32 %a1, 1
60  %v8 = getelementptr inbounds %s.2, %s.2* %v6, i32 0, i32 1
61  %v9 = getelementptr inbounds %s.2, %s.2* %v6, i32 0, i32 0
62  %v10 = select i1 %v7, i32* %v8, i32* %v9
63  %v11 = tail call i32 @f5(i32* %v10) #4
64  br label %b9
65
66b9:                                               ; preds = %b8, %b7
67  %v12 = phi i32 [ 0, %b7 ], [ %v11, %b8 ]
68  tail call void @f3(i32 %v12) #4
69  br label %b10
70
71b10:                                              ; preds = %b9, %b5
72  %v13 = phi i32 [ 0, %b5 ], [ %v12, %b9 ]
73  ret i32 %v13
74}
75
76; Function Attrs: noreturn optsize
77declare void @f2(%s.0*) #1
78
79; Function Attrs: optsize
80declare void @f3(i32) #2
81
82; Function Attrs: optsize
83declare zeroext i8 @f4(%s.1*) #2
84
85; Function Attrs: optsize
86declare i32 @f5(i32*) #2
87
88; Function Attrs: minsize nounwind
89define i32 @f6(%s.1* %a0) #0 {
90b0:
91  %v0 = tail call i32 @f1(%s.1* %a0, i32 1)
92  ret i32 %v0
93}
94
95attributes #0 = { minsize nounwind }
96attributes #1 = { noreturn optsize }
97attributes #2 = { optsize }
98attributes #3 = { noreturn nounwind optsize }
99attributes #4 = { nounwind optsize }
100
101!0 = !{!1, !1, i64 0}
102!1 = !{!"any pointer", !2, i64 0}
103!2 = !{!"omnipotent char", !3, i64 0}
104!3 = !{!"Simple C/C++ TBAA"}
105