1; RUN: llc -march=hexagon -O3 < %s 2; REQUIRES: asserts 3 4target triple = "hexagon" 5 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 } 14%s.8 = type { %s.0* } 15 16define %s.0* @f0(%s.0* %a0, i32* nocapture %a1, i32 %a2, i32 signext %a3) align 2 personality i8* bitcast (i32 (...)* @f11 to i8*) { 17b0: 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 26 %v6 = and i1 %v4, %v5 27 %v7 = bitcast %s.0* %a0 to i8** 28 br i1 %v6, label %b2, label %b1 29 30b1: ; preds = %b0 31 %v8 = bitcast %s.0* %a0 to i8* 32 br label %b16 33 34b2: ; preds = %b0 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 46 47b3: ; preds = %b2 48 br label %b4 49 50b4: ; 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 56 57b5: ; preds = %b16, %b9 58 %v23 = landingpad { i8*, i32 } 59 cleanup 60 %v24 = extractvalue { i8*, i32 } %v23, 0 61 %v25 = extractvalue { i8*, i32 } %v23, 1 62 br label %b18 63 64b6: ; preds = %b13 65 %v26 = landingpad { i8*, i32 } 66 catch i8* null 67 br label %b8 68 69b7: ; preds = %b11, %b2 70 %v27 = phi i32* [ %v21, %b11 ], [ %a1, %b2 ] 71 %v28 = landingpad { i8*, i32 } 72 catch i8* null 73 br label %b8 74 75b8: ; 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 89 %v42 = or i8 %v41, 4 90 invoke void @f6(%s.1* %v38, i8 zeroext %v42, i1 zeroext true) 91 to label %b9 unwind label %b14 92 93b9: ; preds = %b8 94 invoke void @f10() 95 to label %b16 unwind label %b5 96 97b10: ; preds = %b4 98 %v43 = icmp eq i32 %v19, %a3 99 br i1 %v43, label %b11, label %b12 100 101b11: ; preds = %b10 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 115 116b12: ; preds = %b10 117 %v55 = add nsw i32 %v20, -1 118 %v56 = icmp slt i32 %v55, 1 119 br i1 %v56, label %b15, label %b13 120 121b13: ; preds = %b12 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 137 138b14: ; preds = %b8 139 %v69 = landingpad { i8*, i32 } 140 cleanup 141 %v70 = extractvalue { i8*, i32 } %v69, 0 142 %v71 = extractvalue { i8*, i32 } %v69, 1 143 invoke void @f10() 144 to label %b18 unwind label %b20 145 146b15: ; preds = %b12, %b4 147 %v72 = phi i8 [ 2, %b12 ], [ 1, %b4 ] 148 br label %b16 149 150b16: ; 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 163 %v84 = or i8 %v74, 2 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 167 168b17: ; preds = %b16 169 %v86 = getelementptr inbounds %s.7, %s.7* %v0, i32 0, i32 0 170 call void @f1(%s.8* %v86) 171 ret %s.0* %a0 172 173b18: ; 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 179 180b19: ; preds = %b18 181 %v90 = insertvalue { i8*, i32 } undef, i8* %v87, 0 182 %v91 = insertvalue { i8*, i32 } %v90, i32 %v88, 1 183 resume { i8*, i32 } %v91 184 185b20: ; preds = %b18, %b14 186 %v92 = landingpad { i8*, i32 } 187 catch i8* null 188 call void @f8() #1 189 unreachable 190} 191 192declare void @f1(%s.8* nocapture) unnamed_addr align 2 193 194declare void @f2(%s.7* nocapture, %s.0*, i1 zeroext) unnamed_addr align 2 195 196declare signext i32 @f3(%s.5*) align 2 197 198declare signext i32 @f4(%s.5*) align 2 199 200declare signext i32 @f5(%s.5*) align 2 201 202declare void @f6(%s.1*, i8 zeroext, i1 zeroext) align 2 203 204declare void @f7(%s.1*, i8 zeroext, i1 zeroext) align 2 205 206declare void @f8() 207 208declare i8* @f9(i8*) 209 210declare void @f10() 211 212declare i32 @f11(...) 213 214attributes #0 = { nounwind } 215attributes #1 = { noreturn nounwind } 216 217!0 = !{!1, !1, i64 0} 218!1 = !{!"int", !2} 219!2 = !{!"omnipotent char", !3} 220!3 = !{!"Simple C/C++ TBAA"} 221!4 = !{!5, !5, i64 0} 222!5 = !{!"bool", !2} 223!6 = !{i8 0, i8 2} 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} 232