1 ; RUN: llc -march=hexagon -O3 < %s
4 target triple = "hexagon"
6 %s.0 = type { i32 (...)**, i32, %s.1 }
7 %s.1 = type { %s.2, %s.5*, %s.6*, i32 }
8 %s.2 = type { i32 (...)**, i32, i8, i8, i16, i32, i32, %s.3*, %s.4*, i32* }
9 %s.3 = type { %s.3*, i32, i32, i8* }
10 %s.4 = type { %s.4*, i32, void (i8, %s.2*, i32)* }
11 %s.5 = type { i32 (...)**, i8, i32*, i32*, i32**, i32**, i32*, i32*, i32**, i32**, i32*, i32*, i32**, i32**, i32* }
12 %s.6 = type { i32 (...)**, %s.1 }
13 %s.7 = type { %s.8, i8 }
16 define %s.0* @f0(%s.0* %a0, i32* nocapture %a1, i32 %a2, i32 signext %a3) align 2 personality i8* bitcast (i32 (...)* @f11 to i8*) {
18 %v0 = alloca %s.7, align 4
19 %v1 = getelementptr inbounds %s.0, %s.0* %a0, i32 0, i32 1
20 store i32 0, i32* %v1, align 4, !tbaa !0
21 call void @f2(%s.7* %v0, %s.0* %a0, i1 zeroext true)
22 %v2 = getelementptr inbounds %s.7, %s.7* %v0, i32 0, i32 1
23 %v3 = load i8, i8* %v2, align 4, !tbaa !4, !range !6
24 %v4 = icmp ne i8 %v3, 0
25 %v5 = icmp sgt i32 %a2, 0
27 %v7 = bitcast %s.0* %a0 to i8**
28 br i1 %v6, label %b2, label %b1
31 %v8 = bitcast %s.0* %a0 to i8*
35 %v9 = load i8*, i8** %v7, align 4, !tbaa !7
36 %v10 = getelementptr i8, i8* %v9, i32 -12
37 %v11 = bitcast i8* %v10 to i32*
38 %v12 = load i32, i32* %v11, align 4
39 %v13 = bitcast %s.0* %a0 to i8*
40 %v14 = add i32 %v12, 32
41 %v15 = getelementptr inbounds i8, i8* %v13, i32 %v14
42 %v16 = bitcast i8* %v15 to %s.5**
43 %v17 = load %s.5*, %s.5** %v16, align 4, !tbaa !9
44 %v18 = invoke signext i32 @f3(%s.5* %v17)
45 to label %b3 unwind label %b7
50 b4: ; preds = %b13, %b3
51 %v19 = phi i32 [ %v68, %b13 ], [ %v18, %b3 ]
52 %v20 = phi i32 [ %v55, %b13 ], [ %a2, %b3 ]
53 %v21 = phi i32* [ %v59, %b13 ], [ %a1, %b3 ]
54 %v22 = icmp eq i32 %v19, -1
55 br i1 %v22, label %b15, label %b10
57 b5: ; preds = %b16, %b9
58 %v23 = landingpad { i8*, i32 }
60 %v24 = extractvalue { i8*, i32 } %v23, 0
61 %v25 = extractvalue { i8*, i32 } %v23, 1
65 %v26 = landingpad { i8*, i32 }
69 b7: ; preds = %b11, %b2
70 %v27 = phi i32* [ %v21, %b11 ], [ %a1, %b2 ]
71 %v28 = landingpad { i8*, i32 }
75 b8: ; preds = %b7, %b6
76 %v29 = phi i32* [ %v59, %b6 ], [ %v27, %b7 ]
77 %v30 = phi { i8*, i32 } [ %v26, %b6 ], [ %v28, %b7 ]
78 %v31 = extractvalue { i8*, i32 } %v30, 0
79 %v32 = call i8* @f9(i8* %v31) #0
80 %v33 = load i8*, i8** %v7, align 4, !tbaa !7
81 %v34 = getelementptr i8, i8* %v33, i32 -12
82 %v35 = bitcast i8* %v34 to i32*
83 %v36 = load i32, i32* %v35, align 4
84 %v37 = getelementptr inbounds i8, i8* %v13, i32 %v36
85 %v38 = bitcast i8* %v37 to %s.1*
86 %v39 = add i32 %v36, 8
87 %v40 = getelementptr inbounds i8, i8* %v13, i32 %v39
88 %v41 = load i8, i8* %v40, align 1, !tbaa !11
90 invoke void @f6(%s.1* %v38, i8 zeroext %v42, i1 zeroext true)
91 to label %b9 unwind label %b14
95 to label %b16 unwind label %b5
98 %v43 = icmp eq i32 %v19, %a3
99 br i1 %v43, label %b11, label %b12
102 %v44 = load i32, i32* %v1, align 4, !tbaa !0
103 %v45 = add nsw i32 %v44, 1
104 store i32 %v45, i32* %v1, align 4, !tbaa !0
105 %v46 = load i8*, i8** %v7, align 4, !tbaa !7
106 %v47 = getelementptr i8, i8* %v46, i32 -12
107 %v48 = bitcast i8* %v47 to i32*
108 %v49 = load i32, i32* %v48, align 4
109 %v50 = add i32 %v49, 32
110 %v51 = getelementptr inbounds i8, i8* %v13, i32 %v50
111 %v52 = bitcast i8* %v51 to %s.5**
112 %v53 = load %s.5*, %s.5** %v52, align 4, !tbaa !9
113 %v54 = invoke signext i32 @f4(%s.5* %v53)
114 to label %b16 unwind label %b7
117 %v55 = add nsw i32 %v20, -1
118 %v56 = icmp slt i32 %v55, 1
119 br i1 %v56, label %b15, label %b13
122 %v57 = load i32, i32* %v1, align 4, !tbaa !0
123 %v58 = add nsw i32 %v57, 1
124 store i32 %v58, i32* %v1, align 4, !tbaa !0
125 %v59 = getelementptr inbounds i32, i32* %v21, i32 1
126 store i32 %v19, i32* %v21, align 4, !tbaa !13
127 %v60 = load i8*, i8** %v7, align 4, !tbaa !7
128 %v61 = getelementptr i8, i8* %v60, i32 -12
129 %v62 = bitcast i8* %v61 to i32*
130 %v63 = load i32, i32* %v62, align 4
131 %v64 = add i32 %v63, 32
132 %v65 = getelementptr inbounds i8, i8* %v13, i32 %v64
133 %v66 = bitcast i8* %v65 to %s.5**
134 %v67 = load %s.5*, %s.5** %v66, align 4, !tbaa !9
135 %v68 = invoke signext i32 @f5(%s.5* %v67)
136 to label %b4 unwind label %b6
139 %v69 = landingpad { i8*, i32 }
141 %v70 = extractvalue { i8*, i32 } %v69, 0
142 %v71 = extractvalue { i8*, i32 } %v69, 1
144 to label %b18 unwind label %b20
146 b15: ; preds = %b12, %b4
147 %v72 = phi i8 [ 2, %b12 ], [ 1, %b4 ]
150 b16: ; preds = %b15, %b11, %b9, %b1
151 %v73 = phi i8* [ %v8, %b1 ], [ %v13, %b11 ], [ %v13, %b9 ], [ %v13, %b15 ]
152 %v74 = phi i8 [ 0, %b1 ], [ 0, %b11 ], [ 0, %b9 ], [ %v72, %b15 ]
153 %v75 = phi i32* [ %a1, %b1 ], [ %v21, %b11 ], [ %v29, %b9 ], [ %v21, %b15 ]
154 store i32 0, i32* %v75, align 4, !tbaa !13
155 %v76 = load i8*, i8** %v7, align 4, !tbaa !7
156 %v77 = getelementptr i8, i8* %v76, i32 -12
157 %v78 = bitcast i8* %v77 to i32*
158 %v79 = load i32, i32* %v78, align 4
159 %v80 = getelementptr inbounds i8, i8* %v73, i32 %v79
160 %v81 = bitcast i8* %v80 to %s.1*
161 %v82 = load i32, i32* %v1, align 4, !tbaa !0
162 %v83 = icmp eq i32 %v82, 0
164 %v85 = select i1 %v83, i8 %v84, i8 %v74
165 invoke void @f7(%s.1* %v81, i8 zeroext %v85, i1 zeroext false)
166 to label %b17 unwind label %b5
169 %v86 = getelementptr inbounds %s.7, %s.7* %v0, i32 0, i32 0
170 call void @f1(%s.8* %v86)
173 b18: ; preds = %b14, %b5
174 %v87 = phi i8* [ %v24, %b5 ], [ %v70, %b14 ]
175 %v88 = phi i32 [ %v25, %b5 ], [ %v71, %b14 ]
176 %v89 = getelementptr inbounds %s.7, %s.7* %v0, i32 0, i32 0
177 invoke void @f1(%s.8* %v89)
178 to label %b19 unwind label %b20
181 %v90 = insertvalue { i8*, i32 } undef, i8* %v87, 0
182 %v91 = insertvalue { i8*, i32 } %v90, i32 %v88, 1
183 resume { i8*, i32 } %v91
185 b20: ; preds = %b18, %b14
186 %v92 = landingpad { i8*, i32 }
192 declare void @f1(%s.8* nocapture) unnamed_addr align 2
194 declare void @f2(%s.7* nocapture, %s.0*, i1 zeroext) unnamed_addr align 2
196 declare signext i32 @f3(%s.5*) align 2
198 declare signext i32 @f4(%s.5*) align 2
200 declare signext i32 @f5(%s.5*) align 2
202 declare void @f6(%s.1*, i8 zeroext, i1 zeroext) align 2
204 declare void @f7(%s.1*, i8 zeroext, i1 zeroext) align 2
212 declare i32 @f11(...)
214 attributes #0 = { nounwind }
215 attributes #1 = { noreturn nounwind }
217 !0 = !{!1, !1, i64 0}
219 !2 = !{!"omnipotent char", !3}
220 !3 = !{!"Simple C/C++ TBAA"}
221 !4 = !{!5, !5, i64 0}
224 !7 = !{!8, !8, i64 0}
225 !8 = !{!"vtable pointer", !3}
226 !9 = !{!10, !10, i64 0}
227 !10 = !{!"any pointer", !2}
228 !11 = !{!12, !12, i64 0}
229 !12 = !{!"_ZTSNSt5_IosbIiE8_IostateE", !2}
230 !13 = !{!14, !14, i64 0}
231 !14 = !{!"wchar_t", !2}