1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt --arm-mve-gather-scatter-lowering -mtriple=thumbv8.1m.main-none-none-eabi -mattr=+mve.fp %s -S -o - | FileCheck %s
4 target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
6 define arm_aapcs_vfpcc void @push_out_add_sub_block(i32* noalias nocapture readonly %data, i32* noalias nocapture %dst, i32 %n.vec) {
7 ; CHECK-LABEL: @push_out_add_sub_block(
8 ; CHECK-NEXT: vector.ph:
9 ; CHECK-NEXT: [[PUSHEDOUTADD:%.*]] = add <4 x i32> <i32 0, i32 2, i32 4, i32 6>, <i32 6, i32 6, i32 6, i32 6>
10 ; CHECK-NEXT: [[SCALEDINDEX:%.*]] = shl <4 x i32> [[PUSHEDOUTADD]], <i32 2, i32 2, i32 2, i32 2>
11 ; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint ptr [[DATA:%.*]] to i32
12 ; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[TMP0]], i64 0
13 ; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <4 x i32> [[DOTSPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer
14 ; CHECK-NEXT: [[STARTINDEX:%.*]] = add <4 x i32> [[SCALEDINDEX]], [[DOTSPLAT]]
15 ; CHECK-NEXT: [[PREINCREMENTSTARTINDEX:%.*]] = sub <4 x i32> [[STARTINDEX]], <i32 32, i32 32, i32 32, i32 32>
16 ; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
18 ; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH:%.*]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY_END:%.*]] ]
19 ; CHECK-NEXT: [[VEC_IND:%.*]] = phi <4 x i32> [ [[PREINCREMENTSTARTINDEX]], [[VECTOR_PH]] ], [ [[TMP4:%.*]], [[VECTOR_BODY_END]] ]
20 ; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[INDEX]], 48
21 ; CHECK-NEXT: br i1 [[TMP1]], label [[LOWER_BLOCK:%.*]], label [[END:%.*]]
23 ; CHECK-NEXT: [[TMP2:%.*]] = call { <4 x i32>, <4 x i32> } @llvm.arm.mve.vldr.gather.base.wb.v4i32.v4i32(<4 x i32> [[VEC_IND]], i32 32)
24 ; CHECK-NEXT: [[TMP3:%.*]] = extractvalue { <4 x i32>, <4 x i32> } [[TMP2]], 0
25 ; CHECK-NEXT: [[TMP4]] = extractvalue { <4 x i32>, <4 x i32> } [[TMP2]], 1
26 ; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds i32, ptr [[DST:%.*]], i32 [[INDEX]]
27 ; CHECK-NEXT: store <4 x i32> [[TMP3]], ptr [[TMP5]], align 4
28 ; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 4
29 ; CHECK-NEXT: br label [[VECTOR_BODY_END]]
30 ; CHECK: vector.body.end:
31 ; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i32 [[INDEX_NEXT]], [[N_VEC:%.*]]
32 ; CHECK-NEXT: br i1 [[TMP6]], label [[END]], label [[VECTOR_BODY]]
34 ; CHECK-NEXT: ret void
40 vector.body: ; preds = %vector.body, %vector.ph
41 %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body.end ]
42 %vec.ind = phi <4 x i32> [ <i32 0, i32 2, i32 4, i32 6>, %vector.ph ], [ %vec.ind.next, %vector.body.end ]
43 %0 = icmp eq i32 %index, 48
44 br i1 %0, label %lower.block, label %end
46 lower.block: ; preds = %vector.body
47 %1 = add <4 x i32> %vec.ind, <i32 6, i32 6, i32 6, i32 6>
48 %2 = getelementptr inbounds i32, i32* %data, <4 x i32> %1
49 %wide.masked.gather = call <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*> %2, i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i32> undef)
50 %3 = getelementptr inbounds i32, i32* %dst, i32 %index
51 %4 = bitcast i32* %3 to <4 x i32>*
52 store <4 x i32> %wide.masked.gather, <4 x i32>* %4, align 4
53 %index.next = add i32 %index, 4
54 %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
55 br label %vector.body.end
57 vector.body.end: ; preds = %lower.block
58 %5 = icmp eq i32 %index.next, %n.vec
59 br i1 %5, label %end, label %vector.body
65 define arm_aapcs_vfpcc void @push_out_mul_sub_block(i32* noalias nocapture readonly %data, i32* noalias nocapture %dst, i32 %n.vec) {
66 ; CHECK-LABEL: @push_out_mul_sub_block(
67 ; CHECK-NEXT: vector.ph:
68 ; CHECK-NEXT: [[PUSHEDOUTMUL:%.*]] = mul <4 x i32> <i32 0, i32 2, i32 4, i32 6>, <i32 3, i32 3, i32 3, i32 3>
69 ; CHECK-NEXT: [[PRODUCT:%.*]] = mul <4 x i32> <i32 8, i32 8, i32 8, i32 8>, <i32 3, i32 3, i32 3, i32 3>
70 ; CHECK-NEXT: [[PUSHEDOUTADD:%.*]] = add <4 x i32> [[PUSHEDOUTMUL]], <i32 6, i32 6, i32 6, i32 6>
71 ; CHECK-NEXT: [[SCALEDINDEX:%.*]] = shl <4 x i32> [[PUSHEDOUTADD]], <i32 2, i32 2, i32 2, i32 2>
72 ; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint ptr [[DATA:%.*]] to i32
73 ; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[TMP0]], i64 0
74 ; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <4 x i32> [[DOTSPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer
75 ; CHECK-NEXT: [[STARTINDEX:%.*]] = add <4 x i32> [[SCALEDINDEX]], [[DOTSPLAT]]
76 ; CHECK-NEXT: [[PREINCREMENTSTARTINDEX:%.*]] = sub <4 x i32> [[STARTINDEX]], <i32 96, i32 96, i32 96, i32 96>
77 ; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
79 ; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH:%.*]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY_END:%.*]] ]
80 ; CHECK-NEXT: [[VEC_IND:%.*]] = phi <4 x i32> [ [[PREINCREMENTSTARTINDEX]], [[VECTOR_PH]] ], [ [[TMP4:%.*]], [[VECTOR_BODY_END]] ]
81 ; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[INDEX]], 48
82 ; CHECK-NEXT: br i1 [[TMP1]], label [[LOWER_BLOCK:%.*]], label [[END:%.*]]
84 ; CHECK-NEXT: [[TMP2:%.*]] = call { <4 x i32>, <4 x i32> } @llvm.arm.mve.vldr.gather.base.wb.v4i32.v4i32(<4 x i32> [[VEC_IND]], i32 96)
85 ; CHECK-NEXT: [[TMP3:%.*]] = extractvalue { <4 x i32>, <4 x i32> } [[TMP2]], 0
86 ; CHECK-NEXT: [[TMP4]] = extractvalue { <4 x i32>, <4 x i32> } [[TMP2]], 1
87 ; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds i32, ptr [[DST:%.*]], i32 [[INDEX]]
88 ; CHECK-NEXT: store <4 x i32> [[TMP3]], ptr [[TMP5]], align 4
89 ; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 4
90 ; CHECK-NEXT: br label [[VECTOR_BODY_END]]
91 ; CHECK: vector.body.end:
92 ; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i32 [[INDEX_NEXT]], [[N_VEC:%.*]]
93 ; CHECK-NEXT: br i1 [[TMP6]], label [[END]], label [[VECTOR_BODY]]
95 ; CHECK-NEXT: ret void
101 vector.body: ; preds = %vector.body, %vector.ph
102 %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body.end ]
103 %vec.ind = phi <4 x i32> [ <i32 0, i32 2, i32 4, i32 6>, %vector.ph ], [ %vec.ind.next, %vector.body.end ]
104 %0 = icmp eq i32 %index, 48
105 br i1 %0, label %lower.block, label %end
107 lower.block: ; preds = %vector.body
108 %1 = mul <4 x i32> %vec.ind, <i32 3, i32 3, i32 3, i32 3>
109 %2 = add <4 x i32> %1, <i32 6, i32 6, i32 6, i32 6>
110 %3 = getelementptr inbounds i32, i32* %data, <4 x i32> %2
111 %wide.masked.gather = call <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*> %3, i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i32> undef)
112 %4 = getelementptr inbounds i32, i32* %dst, i32 %index
113 %5 = bitcast i32* %4 to <4 x i32>*
114 store <4 x i32> %wide.masked.gather, <4 x i32>* %5, align 4
115 %index.next = add i32 %index, 4
116 %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
117 br label %vector.body.end
119 vector.body.end: ; preds = %lower.block
120 %6 = icmp eq i32 %index.next, %n.vec
121 br i1 %6, label %end, label %vector.body
128 define arm_aapcs_vfpcc void @push_out_mul_sub_loop(i32* noalias nocapture readonly %data, i32* noalias nocapture %dst, i32 %n.vec) {
129 ; CHECK-LABEL: @push_out_mul_sub_loop(
130 ; CHECK-NEXT: vector.ph:
131 ; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
132 ; CHECK: vector.body:
133 ; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH:%.*]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY_END:%.*]] ]
134 ; CHECK-NEXT: [[VEC_IND:%.*]] = phi <4 x i32> [ <i32 0, i32 2, i32 4, i32 6>, [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[VECTOR_BODY_END]] ]
135 ; CHECK-NEXT: br label [[VECTOR_2_PH:%.*]]
136 ; CHECK: vector.2.ph:
137 ; CHECK-NEXT: br label [[VECTOR_2_BODY:%.*]]
138 ; CHECK: vector.2.body:
139 ; CHECK-NEXT: [[TMP0:%.*]] = mul <4 x i32> [[VEC_IND]], <i32 3, i32 3, i32 3, i32 3>
140 ; CHECK-NEXT: [[SCALEDINDEX:%.*]] = shl <4 x i32> [[TMP0]], <i32 2, i32 2, i32 2, i32 2>
141 ; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[DATA:%.*]] to i32
142 ; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <4 x i32> poison, i32 [[TMP1]], i64 0
143 ; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <4 x i32> [[DOTSPLATINSERT]], <4 x i32> poison, <4 x i32> zeroinitializer
144 ; CHECK-NEXT: [[STARTINDEX:%.*]] = add <4 x i32> [[SCALEDINDEX]], [[DOTSPLAT]]
145 ; CHECK-NEXT: [[TMP2:%.*]] = call <4 x i32> @llvm.arm.mve.vldr.gather.base.v4i32.v4i32(<4 x i32> [[STARTINDEX]], i32 24)
146 ; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds i32, ptr [[DST:%.*]], i32 [[INDEX]]
147 ; CHECK-NEXT: store <4 x i32> [[TMP2]], ptr [[TMP3]], align 4
148 ; CHECK-NEXT: br label [[VECTOR_2_BODY_END:%.*]]
149 ; CHECK: vector.2.body.end:
150 ; CHECK-NEXT: [[INDEX_2_NEXT:%.*]] = add i32 [[INDEX]], 4
151 ; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[INDEX_2_NEXT]], 16
152 ; CHECK-NEXT: br i1 [[TMP4]], label [[VECTOR_BODY_END]], label [[VECTOR_2_BODY]]
153 ; CHECK: vector.body.end:
154 ; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 4
155 ; CHECK-NEXT: [[VEC_IND_NEXT]] = add <4 x i32> [[VEC_IND]], <i32 8, i32 8, i32 8, i32 8>
156 ; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i32 [[INDEX_NEXT]], [[N_VEC:%.*]]
157 ; CHECK-NEXT: br i1 [[TMP5]], label [[END:%.*]], label [[VECTOR_BODY]]
159 ; CHECK-NEXT: ret void
163 br label %vector.body
165 vector.body: ; preds = %vector.body, %vector.ph
166 %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body.end ]
167 %vec.ind = phi <4 x i32> [ <i32 0, i32 2, i32 4, i32 6>, %vector.ph ], [ %vec.ind.next, %vector.body.end ]
168 br label %vector.2.ph
171 br label %vector.2.body
173 vector.2.body: ; preds = %vector.body
174 %0 = mul <4 x i32> %vec.ind, <i32 3, i32 3, i32 3, i32 3>
175 %1 = add <4 x i32> %0, <i32 6, i32 6, i32 6, i32 6>
176 %2 = getelementptr inbounds i32, i32* %data, <4 x i32> %1
177 %wide.masked.gather = call <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*> %2, i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i32> undef)
178 %3 = getelementptr inbounds i32, i32* %dst, i32 %index
179 %4 = bitcast i32* %3 to <4 x i32>*
180 store <4 x i32> %wide.masked.gather, <4 x i32>* %4, align 4
181 br label %vector.2.body.end
183 vector.2.body.end: ; preds = %lower.block
184 %index.2.next = add i32 %index, 4
185 %5 = icmp eq i32 %index.2.next, 16
186 br i1 %5, label %vector.body.end, label %vector.2.body
188 vector.body.end: ; preds = %lower.block
189 %index.next = add i32 %index, 4
190 %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
191 %6 = icmp eq i32 %index.next, %n.vec
192 br i1 %6, label %end, label %vector.body
198 define arm_aapcs_vfpcc void @invariant_add(i32* noalias nocapture readonly %data, i32* noalias nocapture %dst, i32 %n.vec) {
199 ; CHECK-LABEL: @invariant_add(
200 ; CHECK-NEXT: vector.ph:
201 ; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
202 ; CHECK: vector.body:
203 ; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH:%.*]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
204 ; CHECK-NEXT: [[VEC_IND:%.*]] = phi <4 x i32> [ <i32 0, i32 2, i32 4, i32 6>, [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[VECTOR_BODY]] ]
205 ; CHECK-NEXT: [[L0:%.*]] = mul <4 x i32> [[VEC_IND]], <i32 3, i32 3, i32 3, i32 3>
206 ; CHECK-NEXT: [[L1:%.*]] = add <4 x i32> [[L0]], [[VEC_IND]]
207 ; CHECK-NEXT: [[TMP0:%.*]] = call <4 x i32> @llvm.arm.mve.vldr.gather.offset.v4i32.p0.v4i32(ptr [[DATA:%.*]], <4 x i32> [[L1]], i32 32, i32 2, i32 1)
208 ; CHECK-NEXT: [[L3:%.*]] = getelementptr inbounds i32, ptr [[DST:%.*]], i32 [[INDEX]]
209 ; CHECK-NEXT: store <4 x i32> [[TMP0]], ptr [[L3]], align 4
210 ; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 4
211 ; CHECK-NEXT: [[VEC_IND_NEXT]] = add <4 x i32> [[VEC_IND]], <i32 8, i32 8, i32 8, i32 8>
212 ; CHECK-NEXT: [[L5:%.*]] = icmp eq i32 [[INDEX_NEXT]], [[N_VEC:%.*]]
213 ; CHECK-NEXT: br i1 [[L5]], label [[END:%.*]], label [[VECTOR_BODY]]
215 ; CHECK-NEXT: ret void
219 br label %vector.body
221 vector.body: ; preds = %vector.body, %vector.ph
222 %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
223 %vec.ind = phi <4 x i32> [ <i32 0, i32 2, i32 4, i32 6>, %vector.ph ], [ %vec.ind.next, %vector.body ]
224 %l0 = mul <4 x i32> %vec.ind, <i32 3, i32 3, i32 3, i32 3>
225 %l1 = add <4 x i32> %l0, %vec.ind
226 %l2 = getelementptr inbounds i32, i32* %data, <4 x i32> %l1
227 %wide.masked.gather = call <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*> %l2, i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i32> undef)
228 %l3 = getelementptr inbounds i32, i32* %dst, i32 %index
229 %l4 = bitcast i32* %l3 to <4 x i32>*
230 store <4 x i32> %wide.masked.gather, <4 x i32>* %l4, align 4
231 %index.next = add i32 %index, 4
232 %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
233 %l5 = icmp eq i32 %index.next, %n.vec
234 br i1 %l5, label %end, label %vector.body
240 define void @gatherload(i32 %n, i32 %m, i32* nocapture %a, i32* nocapture readonly %b, i32 %call.us.us) {
241 ; CHECK-LABEL: @gatherload(
243 ; CHECK-NEXT: [[CMP38:%.*]] = icmp sgt i32 [[N:%.*]], 0
244 ; CHECK-NEXT: br i1 [[CMP38]], label [[FOR_BODY_LR_PH:%.*]], label [[FOR_END16:%.*]]
245 ; CHECK: for.body.lr.ph:
246 ; CHECK-NEXT: [[CMP636:%.*]] = icmp sgt i32 [[M:%.*]], 0
247 ; CHECK-NEXT: br i1 [[CMP636]], label [[FOR_BODY_US_US_PREHEADER:%.*]], label [[FOR_BODY:%.*]]
248 ; CHECK: for.body.us.us.preheader:
249 ; CHECK-NEXT: [[TMP0:%.*]] = shl nuw i32 [[M]], 2
250 ; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i32, ptr [[A:%.*]], i32 [[M]]
251 ; CHECK-NEXT: [[SCEVGEP64:%.*]] = getelementptr i32, ptr [[B:%.*]], i32 [[M]]
252 ; CHECK-NEXT: [[MIN_ITERS_CHECK:%.*]] = icmp ult i32 [[M]], 4
253 ; CHECK-NEXT: [[BOUND0:%.*]] = icmp ugt ptr [[SCEVGEP64]], [[A]]
254 ; CHECK-NEXT: [[BOUND1:%.*]] = icmp ugt ptr [[SCEVGEP]], [[B]]
255 ; CHECK-NEXT: [[FOUND_CONFLICT:%.*]] = and i1 [[BOUND0]], [[BOUND1]]
256 ; CHECK-NEXT: [[N_VEC:%.*]] = and i32 [[M]], -4
257 ; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 [[N_VEC]], [[M]]
258 ; CHECK-NEXT: br label [[FOR_BODY_US_US:%.*]]
259 ; CHECK: for.body.us.us:
260 ; CHECK-NEXT: [[I_039_US_US:%.*]] = phi i32 [ [[INC15_US_US:%.*]], [[FOR_COND5_FOR_END13_CRIT_EDGE_US_US:%.*]] ], [ 0, [[FOR_BODY_US_US_PREHEADER]] ]
261 ; CHECK-NEXT: [[VLA_US_US:%.*]] = alloca i32, i32 [[CALL_US_US:%.*]], align 4
262 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr nonnull align 4 [[VLA_US_US]], ptr align 4 [[A]], i32 [[TMP0]], i1 false)
263 ; CHECK-NEXT: [[BRMERGE:%.*]] = select i1 [[MIN_ITERS_CHECK]], i1 true, i1 [[FOUND_CONFLICT]]
264 ; CHECK-NEXT: br i1 [[BRMERGE]], label [[FOR_BODY7_US_US_PREHEADER:%.*]], label [[VECTOR_BODY:%.*]]
265 ; CHECK: vector.body:
266 ; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ], [ 0, [[FOR_BODY_US_US]] ]
267 ; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i32, ptr [[B]], i32 [[INDEX]]
268 ; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[TMP1]], align 4
269 ; CHECK-NEXT: [[TMP2:%.*]] = call <4 x i32> @llvm.arm.mve.vldr.gather.offset.v4i32.p0.v4i32(ptr [[VLA_US_US]], <4 x i32> [[WIDE_LOAD]], i32 32, i32 2, i32 1)
270 ; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds i32, ptr [[A]], i32 [[INDEX]]
271 ; CHECK-NEXT: store <4 x i32> [[TMP2]], ptr [[TMP3]], align 4
272 ; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i32 [[INDEX]], 4
273 ; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[INDEX_NEXT]], [[N_VEC]]
274 ; CHECK-NEXT: br i1 [[TMP4]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]]
275 ; CHECK: middle.block:
276 ; CHECK-NEXT: br i1 [[CMP_N]], label [[FOR_COND5_FOR_END13_CRIT_EDGE_US_US]], label [[FOR_BODY7_US_US_PREHEADER]]
277 ; CHECK: for.body7.us.us.preheader:
278 ; CHECK-NEXT: [[J_137_US_US_PH:%.*]] = phi i32 [ 0, [[FOR_BODY_US_US]] ], [ [[N_VEC]], [[MIDDLE_BLOCK]] ]
279 ; CHECK-NEXT: br label [[FOR_BODY7_US_US:%.*]]
280 ; CHECK: for.body7.us.us:
281 ; CHECK-NEXT: [[J_137_US_US:%.*]] = phi i32 [ [[INC12_US_US:%.*]], [[FOR_BODY7_US_US]] ], [ [[J_137_US_US_PH]], [[FOR_BODY7_US_US_PREHEADER]] ]
282 ; CHECK-NEXT: [[ARRAYIDX8_US_US:%.*]] = getelementptr inbounds i32, ptr [[B]], i32 [[J_137_US_US]]
283 ; CHECK-NEXT: [[TMP5:%.*]] = load i32, ptr [[ARRAYIDX8_US_US]], align 4
284 ; CHECK-NEXT: [[ARRAYIDX9_US_US:%.*]] = getelementptr inbounds i32, ptr [[VLA_US_US]], i32 [[TMP5]]
285 ; CHECK-NEXT: [[TMP6:%.*]] = load i32, ptr [[ARRAYIDX9_US_US]], align 4
286 ; CHECK-NEXT: [[ARRAYIDX10_US_US:%.*]] = getelementptr inbounds i32, ptr [[A]], i32 [[J_137_US_US]]
287 ; CHECK-NEXT: store i32 [[TMP6]], ptr [[ARRAYIDX10_US_US]], align 4
288 ; CHECK-NEXT: [[INC12_US_US]] = add nuw nsw i32 [[J_137_US_US]], 1
289 ; CHECK-NEXT: [[EXITCOND58_NOT:%.*]] = icmp eq i32 [[INC12_US_US]], [[M]]
290 ; CHECK-NEXT: br i1 [[EXITCOND58_NOT]], label [[FOR_COND5_FOR_END13_CRIT_EDGE_US_US]], label [[FOR_BODY7_US_US]]
291 ; CHECK: for.cond5.for.end13_crit_edge.us.us:
292 ; CHECK-NEXT: [[INC15_US_US]] = add nuw nsw i32 [[I_039_US_US]], 1
293 ; CHECK-NEXT: [[EXITCOND59_NOT:%.*]] = icmp eq i32 [[INC15_US_US]], [[N]]
294 ; CHECK-NEXT: br i1 [[EXITCOND59_NOT]], label [[FOR_END16]], label [[FOR_BODY_US_US]]
296 ; CHECK-NEXT: [[I_039:%.*]] = phi i32 [ [[INC15:%.*]], [[FOR_BODY]] ], [ 0, [[FOR_BODY_LR_PH]] ]
297 ; CHECK-NEXT: [[INC15]] = add nuw nsw i32 [[I_039]], 1
298 ; CHECK-NEXT: [[EXITCOND_NOT:%.*]] = icmp eq i32 [[INC15]], [[N]]
299 ; CHECK-NEXT: br i1 [[EXITCOND_NOT]], label [[FOR_END16]], label [[FOR_BODY]]
301 ; CHECK-NEXT: ret void
304 %a57 = bitcast i32* %a to i8*
305 %cmp38 = icmp sgt i32 %n, 0
306 br i1 %cmp38, label %for.body.lr.ph, label %for.end16
308 for.body.lr.ph: ; preds = %entry
309 %cmp636 = icmp sgt i32 %m, 0
310 br i1 %cmp636, label %for.body.us.us.preheader, label %for.body
312 for.body.us.us.preheader: ; preds = %for.body.lr.ph
313 %0 = shl nuw i32 %m, 2
314 %scevgep = getelementptr i32, i32* %a, i32 %m
315 %scevgep64 = getelementptr i32, i32* %b, i32 %m
316 %min.iters.check = icmp ult i32 %m, 4
317 %bound0 = icmp ugt i32* %scevgep64, %a
318 %bound1 = icmp ugt i32* %scevgep, %b
319 %found.conflict = and i1 %bound0, %bound1
320 %n.vec = and i32 %m, -4
321 %cmp.n = icmp eq i32 %n.vec, %m
322 br label %for.body.us.us
324 for.body.us.us: ; preds = %for.body.us.us.preheader, %for.cond5.for.end13_crit_edge.us.us
325 %i.039.us.us = phi i32 [ %inc15.us.us, %for.cond5.for.end13_crit_edge.us.us ], [ 0, %for.body.us.us.preheader ]
327 %vla.us.us = alloca i32, i32 %call.us.us, align 4
328 %vla.us.us56 = bitcast i32* %vla.us.us to i8*
329 call void @llvm.memcpy.p0i8.p0i8.i32(i8* nonnull align 4 %vla.us.us56, i8* align 4 %a57, i32 %0, i1 false)
330 %brmerge = select i1 %min.iters.check, i1 true, i1 %found.conflict
331 br i1 %brmerge, label %for.body7.us.us.preheader, label %vector.body
333 vector.body: ; preds = %for.body.us.us, %vector.body
334 %index = phi i32 [ %index.next, %vector.body ], [ 0, %for.body.us.us ]
335 %2 = getelementptr inbounds i32, i32* %b, i32 %index
336 %3 = bitcast i32* %2 to <4 x i32>*
337 %wide.load = load <4 x i32>, <4 x i32>* %3, align 4
338 %4 = getelementptr inbounds i32, i32* %vla.us.us, <4 x i32> %wide.load
339 %wide.masked.gather = call <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*> %4, i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i32> undef)
340 %5 = getelementptr inbounds i32, i32* %a, i32 %index
341 %6 = bitcast i32* %5 to <4 x i32>*
342 store <4 x i32> %wide.masked.gather, <4 x i32>* %6, align 4
343 %index.next = add nuw i32 %index, 4
344 %7 = icmp eq i32 %index.next, %n.vec
345 br i1 %7, label %middle.block, label %vector.body
347 middle.block: ; preds = %vector.body
348 br i1 %cmp.n, label %for.cond5.for.end13_crit_edge.us.us, label %for.body7.us.us.preheader
350 for.body7.us.us.preheader: ; preds = %for.body.us.us, %middle.block
351 %j.137.us.us.ph = phi i32 [ 0, %for.body.us.us ], [ %n.vec, %middle.block ]
352 br label %for.body7.us.us
354 for.body7.us.us: ; preds = %for.body7.us.us.preheader, %for.body7.us.us
355 %j.137.us.us = phi i32 [ %inc12.us.us, %for.body7.us.us ], [ %j.137.us.us.ph, %for.body7.us.us.preheader ]
356 %arrayidx8.us.us = getelementptr inbounds i32, i32* %b, i32 %j.137.us.us
357 %8 = load i32, i32* %arrayidx8.us.us, align 4
358 %arrayidx9.us.us = getelementptr inbounds i32, i32* %vla.us.us, i32 %8
359 %9 = load i32, i32* %arrayidx9.us.us, align 4
360 %arrayidx10.us.us = getelementptr inbounds i32, i32* %a, i32 %j.137.us.us
361 store i32 %9, i32* %arrayidx10.us.us, align 4
362 %inc12.us.us = add nuw nsw i32 %j.137.us.us, 1
363 %exitcond58.not = icmp eq i32 %inc12.us.us, %m
364 br i1 %exitcond58.not, label %for.cond5.for.end13_crit_edge.us.us, label %for.body7.us.us
366 for.cond5.for.end13_crit_edge.us.us: ; preds = %for.body7.us.us, %middle.block
367 %inc15.us.us = add nuw nsw i32 %i.039.us.us, 1
368 %exitcond59.not = icmp eq i32 %inc15.us.us, %n
369 br i1 %exitcond59.not, label %for.end16, label %for.body.us.us
371 for.body: ; preds = %for.body.lr.ph, %for.body
372 %i.039 = phi i32 [ %inc15, %for.body ], [ 0, %for.body.lr.ph ]
373 %inc15 = add nuw nsw i32 %i.039, 1
374 %exitcond.not = icmp eq i32 %inc15, %n
375 br i1 %exitcond.not, label %for.end16, label %for.body
377 for.end16: ; preds = %for.body, %for.cond5.for.end13_crit_edge.us.us, %entry
381 declare <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*>, i32, <4 x i1>, <4 x i32>)
382 declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i1)