1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s  -loop-vectorize -force-vector-width=2 -force-vector-interleave=2  -S | FileCheck %s
3
4define void @test1(float* noalias nocapture %a, float* noalias nocapture readonly %b) {
5; CHECK-LABEL: @test1(
6; CHECK-NEXT:  entry:
7; CHECK-NEXT:    br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
8; CHECK:       vector.ph:
9; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]
10; CHECK:       vector.body:
11; CHECK-NEXT:    [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
12; CHECK-NEXT:    [[TMP0:%.*]] = add i64 [[INDEX]], 0
13; CHECK-NEXT:    [[TMP1:%.*]] = add i64 [[INDEX]], 2
14; CHECK-NEXT:    [[TMP2:%.*]] = getelementptr inbounds float, float* [[B:%.*]], i64 [[TMP0]]
15; CHECK-NEXT:    [[TMP3:%.*]] = getelementptr inbounds float, float* [[B]], i64 [[TMP1]]
16; CHECK-NEXT:    [[TMP4:%.*]] = getelementptr inbounds float, float* [[TMP2]], i32 0
17; CHECK-NEXT:    [[TMP5:%.*]] = bitcast float* [[TMP4]] to <2 x float>*
18; CHECK-NEXT:    [[WIDE_LOAD:%.*]] = load <2 x float>, <2 x float>* [[TMP5]], align 4
19; CHECK-NEXT:    [[TMP6:%.*]] = getelementptr inbounds float, float* [[TMP2]], i32 2
20; CHECK-NEXT:    [[TMP7:%.*]] = bitcast float* [[TMP6]] to <2 x float>*
21; CHECK-NEXT:    [[WIDE_LOAD1:%.*]] = load <2 x float>, <2 x float>* [[TMP7]], align 4
22; CHECK-NEXT:    [[TMP8:%.*]] = fcmp ogt <2 x float> [[WIDE_LOAD]], <float 1.000000e+02, float 1.000000e+02>
23; CHECK-NEXT:    [[TMP9:%.*]] = fcmp ogt <2 x float> [[WIDE_LOAD1]], <float 1.000000e+02, float 1.000000e+02>
24; CHECK-NEXT:    [[TMP10:%.*]] = extractelement <2 x i1> [[TMP8]], i32 0
25; CHECK-NEXT:    tail call void @llvm.assume(i1 [[TMP10]])
26; CHECK-NEXT:    [[TMP11:%.*]] = extractelement <2 x i1> [[TMP8]], i32 1
27; CHECK-NEXT:    tail call void @llvm.assume(i1 [[TMP11]])
28; CHECK-NEXT:    [[TMP12:%.*]] = extractelement <2 x i1> [[TMP9]], i32 0
29; CHECK-NEXT:    tail call void @llvm.assume(i1 [[TMP12]])
30; CHECK-NEXT:    [[TMP13:%.*]] = extractelement <2 x i1> [[TMP9]], i32 1
31; CHECK-NEXT:    tail call void @llvm.assume(i1 [[TMP13]])
32; CHECK-NEXT:    [[TMP14:%.*]] = fadd <2 x float> [[WIDE_LOAD]], <float 1.000000e+00, float 1.000000e+00>
33; CHECK-NEXT:    [[TMP15:%.*]] = fadd <2 x float> [[WIDE_LOAD1]], <float 1.000000e+00, float 1.000000e+00>
34; CHECK-NEXT:    [[TMP16:%.*]] = getelementptr inbounds float, float* [[A:%.*]], i64 [[TMP0]]
35; CHECK-NEXT:    [[TMP17:%.*]] = getelementptr inbounds float, float* [[A]], i64 [[TMP1]]
36; CHECK-NEXT:    [[TMP18:%.*]] = getelementptr inbounds float, float* [[TMP16]], i32 0
37; CHECK-NEXT:    [[TMP19:%.*]] = bitcast float* [[TMP18]] to <2 x float>*
38; CHECK-NEXT:    store <2 x float> [[TMP14]], <2 x float>* [[TMP19]], align 4
39; CHECK-NEXT:    [[TMP20:%.*]] = getelementptr inbounds float, float* [[TMP16]], i32 2
40; CHECK-NEXT:    [[TMP21:%.*]] = bitcast float* [[TMP20]] to <2 x float>*
41; CHECK-NEXT:    store <2 x float> [[TMP15]], <2 x float>* [[TMP21]], align 4
42; CHECK-NEXT:    [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4
43; CHECK-NEXT:    [[TMP22:%.*]] = icmp eq i64 [[INDEX_NEXT]], 1600
44; CHECK-NEXT:    br i1 [[TMP22]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]
45; CHECK:       middle.block:
46; CHECK-NEXT:    [[CMP_N:%.*]] = icmp eq i64 1600, 1600
47; CHECK-NEXT:    br i1 [[CMP_N]], label [[FOR_END:%.*]], label [[SCALAR_PH]]
48; CHECK:       scalar.ph:
49; CHECK-NEXT:    [[BC_RESUME_VAL:%.*]] = phi i64 [ 1600, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
50; CHECK-NEXT:    br label [[FOR_BODY:%.*]]
51; CHECK:       for.body:
52; CHECK-NEXT:    [[INDVARS_IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ]
53; CHECK-NEXT:    [[ARRAYIDX:%.*]] = getelementptr inbounds float, float* [[B]], i64 [[INDVARS_IV]]
54; CHECK-NEXT:    [[TMP23:%.*]] = load float, float* [[ARRAYIDX]], align 4
55; CHECK-NEXT:    [[CMP1:%.*]] = fcmp ogt float [[TMP23]], 1.000000e+02
56; CHECK-NEXT:    tail call void @llvm.assume(i1 [[CMP1]])
57; CHECK-NEXT:    [[ADD:%.*]] = fadd float [[TMP23]], 1.000000e+00
58; CHECK-NEXT:    [[ARRAYIDX5:%.*]] = getelementptr inbounds float, float* [[A]], i64 [[INDVARS_IV]]
59; CHECK-NEXT:    store float [[ADD]], float* [[ARRAYIDX5]], align 4
60; CHECK-NEXT:    [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
61; CHECK-NEXT:    [[EXITCOND:%.*]] = icmp eq i64 [[INDVARS_IV]], 1599
62; CHECK-NEXT:    br i1 [[EXITCOND]], label [[FOR_END]], label [[FOR_BODY]], !llvm.loop [[LOOP2:![0-9]+]]
63; CHECK:       for.end:
64; CHECK-NEXT:    ret void
65;
66entry:
67  br label %for.body
68
69
70for.body:                                         ; preds = %for.body, %entry
71  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
72  %arrayidx = getelementptr inbounds float, float* %b, i64 %indvars.iv
73  %0 = load float, float* %arrayidx, align 4
74  %cmp1 = fcmp ogt float %0, 1.000000e+02
75  tail call void @llvm.assume(i1 %cmp1)
76  %add = fadd float %0, 1.000000e+00
77  %arrayidx5 = getelementptr inbounds float, float* %a, i64 %indvars.iv
78  store float %add, float* %arrayidx5, align 4
79  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
80  %exitcond = icmp eq i64 %indvars.iv, 1599
81  br i1 %exitcond, label %for.end, label %for.body
82
83for.end:                                          ; preds = %for.body
84  ret void
85}
86
87declare void @llvm.assume(i1) #0
88
89attributes #0 = { nounwind willreturn }
90
91%struct.data = type { float*, float* }
92
93define void @test2(%struct.data* nocapture readonly %d) {
94; CHECK-LABEL: @test2(
95; CHECK-NEXT:  entry:
96; CHECK-NEXT:    [[B:%.*]] = getelementptr inbounds [[STRUCT_DATA:%.*]], %struct.data* [[D:%.*]], i64 0, i32 1
97; CHECK-NEXT:    [[TMP0:%.*]] = load float*, float** [[B]], align 8
98; CHECK-NEXT:    [[TMP1:%.*]] = bitcast float* [[TMP0]] to i8*
99; CHECK-NEXT:    [[PTRINT:%.*]] = ptrtoint float* [[TMP0]] to i64
100; CHECK-NEXT:    [[MASKEDPTR:%.*]] = and i64 [[PTRINT]], 31
101; CHECK-NEXT:    [[MASKCOND:%.*]] = icmp eq i64 [[MASKEDPTR]], 0
102; CHECK-NEXT:    [[A:%.*]] = getelementptr inbounds [[STRUCT_DATA]], %struct.data* [[D]], i64 0, i32 0
103; CHECK-NEXT:    [[TMP2:%.*]] = load float*, float** [[A]], align 8
104; CHECK-NEXT:    [[TMP3:%.*]] = bitcast float* [[TMP2]] to i8*
105; CHECK-NEXT:    [[PTRINT2:%.*]] = ptrtoint float* [[TMP2]] to i64
106; CHECK-NEXT:    [[MASKEDPTR3:%.*]] = and i64 [[PTRINT2]], 31
107; CHECK-NEXT:    [[MASKCOND4:%.*]] = icmp eq i64 [[MASKEDPTR3]], 0
108; CHECK-NEXT:    br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_MEMCHECK:%.*]]
109; CHECK:       vector.memcheck:
110; CHECK-NEXT:    [[SCEVGEP:%.*]] = getelementptr float, float* [[TMP2]], i64 1600
111; CHECK-NEXT:    [[SCEVGEP1:%.*]] = bitcast float* [[SCEVGEP]] to i8*
112; CHECK-NEXT:    [[SCEVGEP2:%.*]] = getelementptr float, float* [[TMP0]], i64 1600
113; CHECK-NEXT:    [[SCEVGEP23:%.*]] = bitcast float* [[SCEVGEP2]] to i8*
114; CHECK-NEXT:    [[BOUND0:%.*]] = icmp ult i8* [[TMP3]], [[SCEVGEP23]]
115; CHECK-NEXT:    [[BOUND1:%.*]] = icmp ult i8* [[TMP1]], [[SCEVGEP1]]
116; CHECK-NEXT:    [[FOUND_CONFLICT:%.*]] = and i1 [[BOUND0]], [[BOUND1]]
117; CHECK-NEXT:    [[MEMCHECK_CONFLICT:%.*]] = and i1 [[FOUND_CONFLICT]], true
118; CHECK-NEXT:    br i1 [[MEMCHECK_CONFLICT]], label [[SCALAR_PH]], label [[VECTOR_PH:%.*]]
119; CHECK:       vector.ph:
120; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]
121; CHECK:       vector.body:
122; CHECK-NEXT:    [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
123; CHECK-NEXT:    [[TMP4:%.*]] = add i64 [[INDEX]], 0
124; CHECK-NEXT:    [[TMP5:%.*]] = add i64 [[INDEX]], 2
125; CHECK-NEXT:    tail call void @llvm.assume(i1 [[MASKCOND]])
126; CHECK-NEXT:    tail call void @llvm.assume(i1 [[MASKCOND]])
127; CHECK-NEXT:    tail call void @llvm.assume(i1 [[MASKCOND]])
128; CHECK-NEXT:    tail call void @llvm.assume(i1 [[MASKCOND]])
129; CHECK-NEXT:    [[TMP6:%.*]] = getelementptr inbounds float, float* [[TMP0]], i64 [[TMP4]]
130; CHECK-NEXT:    [[TMP7:%.*]] = getelementptr inbounds float, float* [[TMP0]], i64 [[TMP5]]
131; CHECK-NEXT:    [[TMP8:%.*]] = getelementptr inbounds float, float* [[TMP6]], i32 0
132; CHECK-NEXT:    [[TMP9:%.*]] = bitcast float* [[TMP8]] to <2 x float>*
133; CHECK-NEXT:    [[WIDE_LOAD:%.*]] = load <2 x float>, <2 x float>* [[TMP9]], align 4, !alias.scope !4
134; CHECK-NEXT:    [[TMP10:%.*]] = getelementptr inbounds float, float* [[TMP6]], i32 2
135; CHECK-NEXT:    [[TMP11:%.*]] = bitcast float* [[TMP10]] to <2 x float>*
136; CHECK-NEXT:    [[WIDE_LOAD4:%.*]] = load <2 x float>, <2 x float>* [[TMP11]], align 4, !alias.scope !4
137; CHECK-NEXT:    [[TMP12:%.*]] = fadd <2 x float> [[WIDE_LOAD]], <float 1.000000e+00, float 1.000000e+00>
138; CHECK-NEXT:    [[TMP13:%.*]] = fadd <2 x float> [[WIDE_LOAD4]], <float 1.000000e+00, float 1.000000e+00>
139; CHECK-NEXT:    tail call void @llvm.assume(i1 [[MASKCOND4]])
140; CHECK-NEXT:    tail call void @llvm.assume(i1 [[MASKCOND4]])
141; CHECK-NEXT:    tail call void @llvm.assume(i1 [[MASKCOND4]])
142; CHECK-NEXT:    tail call void @llvm.assume(i1 [[MASKCOND4]])
143; CHECK-NEXT:    [[TMP14:%.*]] = getelementptr inbounds float, float* [[TMP2]], i64 [[TMP4]]
144; CHECK-NEXT:    [[TMP15:%.*]] = getelementptr inbounds float, float* [[TMP2]], i64 [[TMP5]]
145; CHECK-NEXT:    [[TMP16:%.*]] = getelementptr inbounds float, float* [[TMP14]], i32 0
146; CHECK-NEXT:    [[TMP17:%.*]] = bitcast float* [[TMP16]] to <2 x float>*
147; CHECK-NEXT:    store <2 x float> [[TMP12]], <2 x float>* [[TMP17]], align 4, !alias.scope !7, !noalias !4
148; CHECK-NEXT:    [[TMP18:%.*]] = getelementptr inbounds float, float* [[TMP14]], i32 2
149; CHECK-NEXT:    [[TMP19:%.*]] = bitcast float* [[TMP18]] to <2 x float>*
150; CHECK-NEXT:    store <2 x float> [[TMP13]], <2 x float>* [[TMP19]], align 4, !alias.scope !7, !noalias !4
151; CHECK-NEXT:    [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4
152; CHECK-NEXT:    [[TMP20:%.*]] = icmp eq i64 [[INDEX_NEXT]], 1600
153; CHECK-NEXT:    br i1 [[TMP20]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP9:![0-9]+]]
154; CHECK:       middle.block:
155; CHECK-NEXT:    [[CMP_N:%.*]] = icmp eq i64 1600, 1600
156; CHECK-NEXT:    br i1 [[CMP_N]], label [[FOR_END:%.*]], label [[SCALAR_PH]]
157; CHECK:       scalar.ph:
158; CHECK-NEXT:    [[BC_RESUME_VAL:%.*]] = phi i64 [ 1600, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ], [ 0, [[VECTOR_MEMCHECK]] ]
159; CHECK-NEXT:    br label [[FOR_BODY:%.*]]
160; CHECK:       for.body:
161; CHECK-NEXT:    [[INDVARS_IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ]
162; CHECK-NEXT:    tail call void @llvm.assume(i1 [[MASKCOND]])
163; CHECK-NEXT:    [[ARRAYIDX:%.*]] = getelementptr inbounds float, float* [[TMP0]], i64 [[INDVARS_IV]]
164; CHECK-NEXT:    [[TMP21:%.*]] = load float, float* [[ARRAYIDX]], align 4
165; CHECK-NEXT:    [[ADD:%.*]] = fadd float [[TMP21]], 1.000000e+00
166; CHECK-NEXT:    tail call void @llvm.assume(i1 [[MASKCOND4]])
167; CHECK-NEXT:    [[ARRAYIDX5:%.*]] = getelementptr inbounds float, float* [[TMP2]], i64 [[INDVARS_IV]]
168; CHECK-NEXT:    store float [[ADD]], float* [[ARRAYIDX5]], align 4
169; CHECK-NEXT:    [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
170; CHECK-NEXT:    [[EXITCOND:%.*]] = icmp eq i64 [[INDVARS_IV]], 1599
171; CHECK-NEXT:    br i1 [[EXITCOND]], label [[FOR_END]], label [[FOR_BODY]], !llvm.loop [[LOOP10:![0-9]+]]
172; CHECK:       for.end:
173; CHECK-NEXT:    ret void
174;
175entry:
176  %b = getelementptr inbounds %struct.data, %struct.data* %d, i64 0, i32 1
177  %0 = load float*, float** %b, align 8
178  %ptrint = ptrtoint float* %0 to i64
179  %maskedptr = and i64 %ptrint, 31
180  %maskcond = icmp eq i64 %maskedptr, 0
181  %a = getelementptr inbounds %struct.data, %struct.data* %d, i64 0, i32 0
182  %1 = load float*, float** %a, align 8
183  %ptrint2 = ptrtoint float* %1 to i64
184  %maskedptr3 = and i64 %ptrint2, 31
185  %maskcond4 = icmp eq i64 %maskedptr3, 0
186  br label %for.body
187
188
189for.body:                                         ; preds = %for.body, %entry
190  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
191  tail call void @llvm.assume(i1 %maskcond)
192  %arrayidx = getelementptr inbounds float, float* %0, i64 %indvars.iv
193  %2 = load float, float* %arrayidx, align 4
194  %add = fadd float %2, 1.000000e+00
195  tail call void @llvm.assume(i1 %maskcond4)
196  %arrayidx5 = getelementptr inbounds float, float* %1, i64 %indvars.iv
197  store float %add, float* %arrayidx5, align 4
198  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
199  %exitcond = icmp eq i64 %indvars.iv, 1599
200  br i1 %exitcond, label %for.end, label %for.body
201
202for.end:                                          ; preds = %for.body
203  ret void
204}
205
206; Test case for PR43620. Make sure we can vectorize with predication in presence
207; of assume calls. For now, check that we drop all assumes in predicated blocks
208; in the vector body.
209define void @predicated_assume(float* noalias nocapture readonly %a, float* noalias nocapture %b, i32 %n) {
210; Check that the vector.body does not contain any assumes.
211; CHECK-LABEL: @predicated_assume(
212; CHECK-NEXT:  entry:
213; CHECK-NEXT:    [[CMP15:%.*]] = icmp eq i32 [[N:%.*]], 0
214; CHECK-NEXT:    br i1 [[CMP15]], label [[FOR_COND_CLEANUP:%.*]], label [[FOR_BODY_PREHEADER:%.*]]
215; CHECK:       for.body.preheader:
216; CHECK-NEXT:    [[TMP0:%.*]] = zext i32 [[N]] to i64
217; CHECK-NEXT:    [[MIN_ITERS_CHECK:%.*]] = icmp ult i64 [[TMP0]], 4
218; CHECK-NEXT:    br i1 [[MIN_ITERS_CHECK]], label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
219; CHECK:       vector.ph:
220; CHECK-NEXT:    [[N_MOD_VF:%.*]] = urem i64 [[TMP0]], 4
221; CHECK-NEXT:    [[N_VEC:%.*]] = sub i64 [[TMP0]], [[N_MOD_VF]]
222; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]
223; CHECK:       vector.body:
224; CHECK-NEXT:    [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
225; CHECK-NEXT:    [[VEC_IND:%.*]] = phi <2 x i64> [ <i64 0, i64 1>, [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[VECTOR_BODY]] ]
226; CHECK-NEXT:    [[STEP_ADD:%.*]] = add <2 x i64> [[VEC_IND]], <i64 2, i64 2>
227; CHECK-NEXT:    [[TMP1:%.*]] = add i64 [[INDEX]], 0
228; CHECK-NEXT:    [[TMP2:%.*]] = add i64 [[INDEX]], 1
229; CHECK-NEXT:    [[TMP3:%.*]] = add i64 [[INDEX]], 2
230; CHECK-NEXT:    [[TMP4:%.*]] = add i64 [[INDEX]], 3
231; CHECK-NEXT:    [[TMP5:%.*]] = icmp ult <2 x i64> [[VEC_IND]], <i64 495616, i64 495616>
232; CHECK-NEXT:    [[TMP6:%.*]] = icmp ult <2 x i64> [[STEP_ADD]], <i64 495616, i64 495616>
233; CHECK-NEXT:    [[TMP7:%.*]] = icmp ult <2 x i64> [[VEC_IND]], <i64 991232, i64 991232>
234; CHECK-NEXT:    [[TMP8:%.*]] = icmp ult <2 x i64> [[STEP_ADD]], <i64 991232, i64 991232>
235; CHECK-NEXT:    [[TMP9:%.*]] = xor <2 x i1> [[TMP5]], <i1 true, i1 true>
236; CHECK-NEXT:    [[TMP10:%.*]] = xor <2 x i1> [[TMP6]], <i1 true, i1 true>
237; CHECK-NEXT:    [[PREDPHI:%.*]] = select <2 x i1> [[TMP5]], <2 x float> <float 2.300000e+01, float 2.300000e+01>, <2 x float> <float 4.200000e+01, float 4.200000e+01>
238; CHECK-NEXT:    [[PREDPHI2:%.*]] = select <2 x i1> [[TMP6]], <2 x float> <float 2.300000e+01, float 2.300000e+01>, <2 x float> <float 4.200000e+01, float 4.200000e+01>
239; CHECK-NEXT:    [[TMP11:%.*]] = getelementptr inbounds float, float* [[A:%.*]], i64 [[TMP1]]
240; CHECK-NEXT:    [[TMP12:%.*]] = getelementptr inbounds float, float* [[A]], i64 [[TMP3]]
241; CHECK-NEXT:    [[TMP13:%.*]] = getelementptr inbounds float, float* [[TMP11]], i32 0
242; CHECK-NEXT:    [[TMP14:%.*]] = bitcast float* [[TMP13]] to <2 x float>*
243; CHECK-NEXT:    [[WIDE_LOAD:%.*]] = load <2 x float>, <2 x float>* [[TMP14]], align 4
244; CHECK-NEXT:    [[TMP15:%.*]] = getelementptr inbounds float, float* [[TMP11]], i32 2
245; CHECK-NEXT:    [[TMP16:%.*]] = bitcast float* [[TMP15]] to <2 x float>*
246; CHECK-NEXT:    [[WIDE_LOAD3:%.*]] = load <2 x float>, <2 x float>* [[TMP16]], align 4
247; CHECK-NEXT:    [[TMP17:%.*]] = fmul <2 x float> [[PREDPHI]], [[WIDE_LOAD]]
248; CHECK-NEXT:    [[TMP18:%.*]] = fmul <2 x float> [[PREDPHI2]], [[WIDE_LOAD3]]
249; CHECK-NEXT:    [[TMP19:%.*]] = getelementptr inbounds float, float* [[B:%.*]], i64 [[TMP1]]
250; CHECK-NEXT:    [[TMP20:%.*]] = getelementptr inbounds float, float* [[B]], i64 [[TMP3]]
251; CHECK-NEXT:    [[TMP21:%.*]] = getelementptr inbounds float, float* [[TMP19]], i32 0
252; CHECK-NEXT:    [[TMP22:%.*]] = bitcast float* [[TMP21]] to <2 x float>*
253; CHECK-NEXT:    store <2 x float> [[TMP17]], <2 x float>* [[TMP22]], align 4
254; CHECK-NEXT:    [[TMP23:%.*]] = getelementptr inbounds float, float* [[TMP19]], i32 2
255; CHECK-NEXT:    [[TMP24:%.*]] = bitcast float* [[TMP23]] to <2 x float>*
256; CHECK-NEXT:    store <2 x float> [[TMP18]], <2 x float>* [[TMP24]], align 4
257; CHECK-NEXT:    [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4
258; CHECK-NEXT:    [[VEC_IND_NEXT]] = add <2 x i64> [[STEP_ADD]], <i64 2, i64 2>
259; CHECK-NEXT:    [[TMP25:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]]
260; CHECK-NEXT:    br i1 [[TMP25]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP11:![0-9]+]]
261; CHECK:       middle.block:
262; CHECK-NEXT:    [[CMP_N:%.*]] = icmp eq i64 [[TMP0]], [[N_VEC]]
263; CHECK-NEXT:    br i1 [[CMP_N]], label [[FOR_COND_CLEANUP_LOOPEXIT:%.*]], label [[SCALAR_PH]]
264; CHECK:       scalar.ph:
265; CHECK-NEXT:    [[BC_RESUME_VAL:%.*]] = phi i64 [ [[N_VEC]], [[MIDDLE_BLOCK]] ], [ 0, [[FOR_BODY_PREHEADER]] ]
266; CHECK-NEXT:    br label [[FOR_BODY:%.*]]
267; CHECK:       for.cond.cleanup.loopexit:
268; CHECK-NEXT:    br label [[FOR_COND_CLEANUP]]
269; CHECK:       for.cond.cleanup:
270; CHECK-NEXT:    ret void
271; CHECK:       for.body:
272; CHECK-NEXT:    [[INDVARS_IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], [[IF_END5:%.*]] ]
273; CHECK-NEXT:    [[CMP1:%.*]] = icmp ult i64 [[INDVARS_IV]], 495616
274; CHECK-NEXT:    br i1 [[CMP1]], label [[IF_END5]], label [[IF_ELSE:%.*]]
275; CHECK:       if.else:
276; CHECK-NEXT:    [[CMP2:%.*]] = icmp ult i64 [[INDVARS_IV]], 991232
277; CHECK-NEXT:    tail call void @llvm.assume(i1 [[CMP2]])
278; CHECK-NEXT:    br label [[IF_END5]]
279; CHECK:       if.end5:
280; CHECK-NEXT:    [[X_0:%.*]] = phi float [ 4.200000e+01, [[IF_ELSE]] ], [ 2.300000e+01, [[FOR_BODY]] ]
281; CHECK-NEXT:    [[ARRAYIDX:%.*]] = getelementptr inbounds float, float* [[A]], i64 [[INDVARS_IV]]
282; CHECK-NEXT:    [[TMP26:%.*]] = load float, float* [[ARRAYIDX]], align 4
283; CHECK-NEXT:    [[MUL:%.*]] = fmul float [[X_0]], [[TMP26]]
284; CHECK-NEXT:    [[ARRAYIDX7:%.*]] = getelementptr inbounds float, float* [[B]], i64 [[INDVARS_IV]]
285; CHECK-NEXT:    store float [[MUL]], float* [[ARRAYIDX7]], align 4
286; CHECK-NEXT:    [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
287; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT]], [[TMP0]]
288; CHECK-NEXT:    br i1 [[CMP]], label [[FOR_COND_CLEANUP_LOOPEXIT]], label [[FOR_BODY]], !llvm.loop [[LOOP12:![0-9]+]]
289;
290entry:
291  %cmp15 = icmp eq i32 %n, 0
292  br i1 %cmp15, label %for.cond.cleanup, label %for.body.preheader
293
294for.body.preheader:                               ; preds = %entry
295  %0 = zext i32 %n to i64
296  br label %for.body
297
298for.cond.cleanup.loopexit:                        ; preds = %if.end5
299  br label %for.cond.cleanup
300
301for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry
302  ret void
303
304for.body:                                         ; preds = %for.body.preheader, %if.end5
305  %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %if.end5 ]
306  %cmp1 = icmp ult i64 %indvars.iv, 495616
307  br i1 %cmp1, label %if.end5, label %if.else
308
309if.else:                                          ; preds = %for.body
310  %cmp2 = icmp ult i64 %indvars.iv, 991232
311  tail call void @llvm.assume(i1 %cmp2)
312  br label %if.end5
313
314if.end5:                                          ; preds = %for.body, %if.else
315  %x.0 = phi float [ 4.200000e+01, %if.else ], [ 2.300000e+01, %for.body ]
316  %arrayidx = getelementptr inbounds float, float* %a, i64 %indvars.iv
317  %1 = load float, float* %arrayidx, align 4
318  %mul = fmul float %x.0, %1
319  %arrayidx7 = getelementptr inbounds float, float* %b, i64 %indvars.iv
320  store float %mul, float* %arrayidx7, align 4
321  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
322  %cmp = icmp eq i64 %indvars.iv.next, %0
323  br i1 %cmp, label %for.cond.cleanup.loopexit, label %for.body
324}
325