1 ; RUN: llc -march=hexagon < %s
4 ; Test that register scvenging does not assert because of wrong
5 ; bits being set for Kill and Def bit vectors in replaceSuperBySubRegs
7 %s.0 = type { i32, ptr, [0 x i32], [0 x i32], [1 x i32] }
8 %s.1 = type { %s.2, %s.4, %s.5 }
12 %s.5 = type { [0 x i32], [0 x ptr] }
14 @g0 = common global i32 0, align 4
15 @g1 = common global %s.0 zeroinitializer, align 4
16 @g2 = common global i32 0, align 4
17 @g3 = common global i32 0, align 4
18 @g4 = common global ptr null, align 4
19 @g5 = common global i32 0, align 4
20 @g6 = common global i32 0, align 4
22 ; Function Attrs: nounwind
23 define i32 @f0(ptr nocapture readonly %a0) #0 {
25 %v0 = alloca [0 x i32], align 4
26 %v1 = load i32, ptr @g0, align 4, !tbaa !0
27 %v3 = load i32, ptr %a0, align 4, !tbaa !0
28 %v4 = load ptr, ptr getelementptr inbounds (%s.0, ptr @g1, i32 0, i32 1), align 4, !tbaa !4
29 %v5 = load i32, ptr @g2, align 4, !tbaa !0
31 %v7 = getelementptr inbounds i32, ptr %v4, i32 %v6
32 %v8 = getelementptr inbounds %s.1, ptr %a0, i32 0, i32 1, i32 0
33 %v9 = load i32, ptr %v8, align 4, !tbaa !0
34 switch i32 %v9, label %b17 [
40 store i32 0, ptr @g3, align 4, !tbaa !0
43 b2: ; preds = %b1, %b0
44 %v10 = icmp eq i32 %v1, 0
45 %v11 = icmp sgt i32 %v3, 0
46 %v13 = sdiv i32 %v3, 2
47 %v14 = add i32 %v13, -1
48 %v15 = getelementptr inbounds [0 x i32], ptr %v0, i32 0, i32 1
49 %v16 = getelementptr inbounds [0 x i32], ptr %v0, i32 0, i32 2
50 %v17 = getelementptr inbounds %s.1, ptr %a0, i32 0, i32 2, i32 1, i32 %v1
51 %v18 = getelementptr inbounds %s.1, ptr %a0, i32 0, i32 2, i32 1, i32 0
53 %v20 = getelementptr inbounds i32, ptr %v4, i32 %v19
54 %v21 = sdiv i32 %v3, 4
55 %v22 = icmp slt i32 %v3, -3
56 %v23 = add i32 %v3, -1
57 %v24 = lshr i32 %v23, 2
58 %v25 = mul i32 %v24, 4
59 %v26 = add i32 %v25, 4
60 %v27 = add i32 %v13, -2
61 %v28 = icmp slt i32 %v26, 0
62 %v29 = add i32 %v21, 1
63 %v30 = select i1 %v22, i32 1, i32 %v29
67 store i32 %v30, ptr @g3, align 4, !tbaa !0
70 b4: ; preds = %b13, %b3, %b2
71 %v31 = phi i32 [ undef, %b2 ], [ %v87, %b3 ], [ %v87, %b13 ]
72 %v32 = phi i32 [ undef, %b2 ], [ %v86, %b3 ], [ %v86, %b13 ]
73 %v33 = phi i32 [ undef, %b2 ], [ %v35, %b3 ], [ %v35, %b13 ]
74 %v34 = phi i32 [ undef, %b2 ], [ %v89, %b3 ], [ %v89, %b13 ]
75 %v35 = phi i32 [ undef, %b2 ], [ %v94, %b3 ], [ %v65, %b13 ]
76 br i1 %v10, label %b6, label %b5
78 b5: ; preds = %b5, %b4
82 br i1 %v11, label %b8, label %b7
85 store i32 0, ptr @g3, align 4, !tbaa !0
89 store i32 %v26, ptr @g3, align 4, !tbaa !0
90 br i1 %v28, label %b9, label %b11
93 %v36 = load ptr, ptr @g4, align 4, !tbaa !7
96 b10: ; preds = %b10, %b9
97 %v37 = phi i32 [ %v26, %b9 ], [ %v45, %b10 ]
98 %v38 = phi i32 [ %v34, %b9 ], [ %v44, %b10 ]
99 %v39 = add nsw i32 %v37, %v33
100 %v40 = shl i32 %v39, 1
101 %v41 = getelementptr inbounds i32, ptr %v36, i32 %v40
102 %v42 = load i32, ptr %v41, align 4, !tbaa !0
103 %v43 = icmp slt i32 %v42, %v31
104 %v44 = select i1 %v43, i32 0, i32 %v38
105 %v45 = add nsw i32 %v37, 1
106 store i32 %v45, ptr @g3, align 4, !tbaa !0
107 %v46 = icmp slt i32 %v45, 0
108 br i1 %v46, label %b10, label %b11
110 b11: ; preds = %b10, %b8, %b7
111 %v47 = phi i32 [ %v26, %b8 ], [ 0, %b7 ], [ 0, %b10 ]
112 %v48 = phi i32 [ %v34, %b8 ], [ %v34, %b7 ], [ %v44, %b10 ]
113 %v49 = load i32, ptr @g5, align 4, !tbaa !0
114 %v50 = icmp slt i32 %v13, %v49
115 %v51 = icmp slt i32 %v47, %v14
116 %v52 = and i1 %v50, %v51
117 br i1 %v52, label %b12, label %b13
120 %v53 = sub i32 %v27, %v47
121 %v54 = lshr i32 %v53, 1
122 %v55 = mul i32 %v54, 2
123 %v56 = add i32 %v47, 2
124 %v57 = add i32 %v56, %v55
125 store i32 %v57, ptr @g3, align 4, !tbaa !0
128 b13: ; preds = %b12, %b11
129 %v58 = shl i32 %v35, 2
130 %v59 = load ptr, ptr @g4, align 4, !tbaa !7
131 %v60 = getelementptr inbounds i32, ptr %v59, i32 %v58
132 %v61 = load i32, ptr %v60, align 4, !tbaa !0
133 %v62 = load i32, ptr %v7, align 4, !tbaa !0
134 %v63 = add nsw i32 %v62, %v61
135 %v64 = add nsw i32 %v63, %v32
136 store i32 %v64, ptr %v15, align 4, !tbaa !0
137 %v65 = add i32 %v35, -1
138 %v66 = getelementptr inbounds i32, ptr %v59, i32 %v65
139 %v67 = load i32, ptr %v66, align 4, !tbaa !0
140 %v68 = sub i32 %v49, %v5
141 %v69 = getelementptr inbounds i32, ptr %v4, i32 %v68
142 %v70 = load i32, ptr %v69, align 4, !tbaa !0
143 %v71 = add nsw i32 %v70, %v67
144 %v72 = load i32, ptr %v16, align 4, !tbaa !0
145 %v73 = add nsw i32 %v71, %v72
146 store i32 %v73, ptr %v16, align 4, !tbaa !0
147 %v74 = load i32, ptr @g6, align 4, !tbaa !0
148 %v75 = load ptr, ptr %v17, align 4, !tbaa !7
149 %v76 = load i32, ptr getelementptr inbounds (%s.0, ptr @g1, i32 0, i32 4, i32 0), align 4, !tbaa !0
150 %v77 = call i32 %v75(ptr getelementptr inbounds (%s.0, ptr @g1, i32 0, i32 4, i32 0), ptr null, ptr null, ptr null, ptr null, i32 %v76, ptr null) #0
151 %v78 = load ptr, ptr %v18, align 4, !tbaa !7
152 %v79 = inttoptr i32 %v74 to ptr
153 %v80 = load i32, ptr getelementptr inbounds (%s.0, ptr @g1, i32 0, i32 4, i32 0), align 4, !tbaa !0
154 %v81 = call i32 %v78(ptr getelementptr inbounds (%s.0, ptr @g1, i32 0, i32 4, i32 0), ptr null, ptr null, ptr null, ptr %v79, i32 %v80, ptr %v0) #0
155 %v82 = load ptr, ptr @g4, align 4, !tbaa !7
156 %v83 = getelementptr inbounds i32, ptr %v82, i32 %v58
157 %v84 = load i32, ptr %v83, align 4, !tbaa !0
158 %v85 = load i32, ptr %v20, align 4, !tbaa !0
159 %v86 = add nsw i32 %v85, %v84
160 store i32 %v86, ptr %v15, align 4, !tbaa !0
161 %v87 = load i32, ptr %v0, align 4, !tbaa !0
162 %v88 = icmp eq i32 %v87, 0
163 %v89 = select i1 %v88, i32 %v48, i32 1
164 store i32 %v89, ptr @g5, align 4, !tbaa !0
165 store i32 0, ptr @g3, align 4, !tbaa !0
166 br i1 %v22, label %b4, label %b14
168 b14: ; preds = %b16, %b13
169 %v90 = phi i32 [ %v95, %b16 ], [ 0, %b13 ]
170 %v91 = phi i32 [ %v94, %b16 ], [ %v65, %b13 ]
171 br i1 %v88, label %b16, label %b15
174 %v92 = mul i32 %v90, -4
175 %v93 = add nsw i32 %v92, 1
178 b16: ; preds = %b15, %b14
179 %v94 = phi i32 [ %v93, %b15 ], [ %v91, %b14 ]
180 %v95 = add nsw i32 %v90, 1
181 %v96 = icmp slt i32 %v90, %v21
182 br i1 %v96, label %b14, label %b3
188 attributes #0 = { nounwind }
190 !0 = !{!1, !1, i64 0}
191 !1 = !{!"int", !2, i64 0}
192 !2 = !{!"omnipotent char", !3, i64 0}
193 !3 = !{!"Simple C/C++ TBAA"}
194 !4 = !{!5, !6, i64 4}
195 !5 = !{!"", !1, i64 0, !6, i64 4, !2, i64 8, !2, i64 8, !2, i64 8}
196 !6 = !{!"any pointer", !2, i64 0}
197 !7 = !{!6, !6, i64 0}