• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s  -loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -dce -instcombine -S | FileCheck --check-prefix VEC4_INTERL1 %s
2; RUN: opt < %s  -loop-vectorize -force-vector-interleave=2 -force-vector-width=4 -dce -instcombine -S | FileCheck --check-prefix VEC4_INTERL2 %s
3; RUN: opt < %s  -loop-vectorize -force-vector-interleave=2 -force-vector-width=1 -dce -instcombine -S | FileCheck --check-prefix VEC1_INTERL2 %s
4; RUN: opt < %s  -loop-vectorize -force-vector-interleave=1 -force-vector-width=2 -dce -simplifycfg -instcombine -simplifycfg -keep-loops=false -S | FileCheck --check-prefix VEC2_INTERL1_PRED_STORE %s
5
6@fp_inc = common global float 0.000000e+00, align 4
7
8;void fp_iv_loop1(float init, float * __restrict__ A, int N) {
9;  float x = init;
10;  for (int i=0; i < N; ++i) {
11;    A[i] = x;
12;    x -= fp_inc;
13;  }
14;}
15
16; VEC4_INTERL1-LABEL: @fp_iv_loop1(
17; VEC4_INTERL1:       vector.ph:
18; VEC4_INTERL1:         [[DOTSPLATINSERT:%.*]] = insertelement <4 x float> undef, float %init, i32 0
19; VEC4_INTERL1-NEXT:    [[DOTSPLAT:%.*]] = shufflevector <4 x float> [[DOTSPLATINSERT]], <4 x float> undef, <4 x i32> zeroinitializer
20; VEC4_INTERL1-NEXT:    [[DOTSPLATINSERT2:%.*]] = insertelement <4 x float> undef, float %fpinc, i32 0
21; VEC4_INTERL1-NEXT:    [[DOTSPLAT3:%.*]] = shufflevector <4 x float> [[DOTSPLATINSERT2]], <4 x float> undef, <4 x i32> zeroinitializer
22; VEC4_INTERL1-NEXT:    [[TMP5:%.*]] = fmul fast <4 x float> [[DOTSPLAT3]], <float 0.000000e+00, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00>
23; VEC4_INTERL1-NEXT:    [[INDUCTION4:%.*]] = fsub fast <4 x float> [[DOTSPLAT]], [[TMP5]]
24; VEC4_INTERL1-NEXT:    [[TMP6:%.*]] = fmul fast float %fpinc, 4.000000e+00
25; VEC4_INTERL1-NEXT:    [[DOTSPLATINSERT5:%.*]] = insertelement <4 x float> undef, float [[TMP6]], i32 0
26; VEC4_INTERL1-NEXT:    [[DOTSPLAT6:%.*]] = shufflevector <4 x float> [[DOTSPLATINSERT5]], <4 x float> undef, <4 x i32> zeroinitializer
27; VEC4_INTERL1-NEXT:    br label %vector.body
28; VEC4_INTERL1:       vector.body:
29; VEC4_INTERL1-NEXT:    [[INDEX:%.*]] = phi i64 [ 0, %vector.ph ], [ [[INDEX_NEXT:%.*]], %vector.body ]
30; VEC4_INTERL1-NEXT:    [[VEC_IND:%.*]] = phi <4 x float> [ [[INDUCTION4]], %vector.ph ], [ [[VEC_IND_NEXT:%.*]], %vector.body ]
31; VEC4_INTERL1-NEXT:    [[TMP8:%.*]] = getelementptr inbounds float, float* %A, i64 [[INDEX]]
32; VEC4_INTERL1-NEXT:    [[TMP9:%.*]] = bitcast float* [[TMP8]] to <4 x float>*
33; VEC4_INTERL1-NEXT:    store <4 x float> [[VEC_IND]], <4 x float>* [[TMP9]], align 4
34; VEC4_INTERL1-NEXT:    [[INDEX_NEXT]] = add i64 [[INDEX]], 4
35; VEC4_INTERL1-NEXT:    [[VEC_IND_NEXT]] = fsub fast <4 x float> [[VEC_IND]], [[DOTSPLAT6]]
36; VEC4_INTERL1:         br i1 {{.*}}, label %middle.block, label %vector.body
37
38; VEC4_INTERL2-LABEL: @fp_iv_loop1(
39; VEC4_INTERL2:       vector.ph:
40; VEC4_INTERL2:         [[DOTSPLATINSERT:%.*]] = insertelement <4 x float> undef, float %init, i32 0
41; VEC4_INTERL2-NEXT:    [[DOTSPLAT:%.*]] = shufflevector <4 x float> [[DOTSPLATINSERT]], <4 x float> undef, <4 x i32> zeroinitializer
42; VEC4_INTERL2-NEXT:    [[DOTSPLATINSERT3:%.*]] = insertelement <4 x float> undef, float %fpinc, i32 0
43; VEC4_INTERL2-NEXT:    [[DOTSPLAT4:%.*]] = shufflevector <4 x float> [[DOTSPLATINSERT3]], <4 x float> undef, <4 x i32> zeroinitializer
44; VEC4_INTERL2-NEXT:    [[TMP5:%.*]] = fmul fast <4 x float> [[DOTSPLAT4]], <float 0.000000e+00, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00>
45; VEC4_INTERL2-NEXT:    [[INDUCTION5:%.*]] = fsub fast <4 x float> [[DOTSPLAT]], [[TMP5]]
46; VEC4_INTERL2-NEXT:    [[TMP6:%.*]] = fmul fast float %fpinc, 4.000000e+00
47; VEC4_INTERL2-NEXT:    [[DOTSPLATINSERT6:%.*]] = insertelement <4 x float> undef, float [[TMP6]], i32 0
48; VEC4_INTERL2-NEXT:    [[DOTSPLAT7:%.*]] = shufflevector <4 x float> [[DOTSPLATINSERT6]], <4 x float> undef, <4 x i32> zeroinitializer
49; VEC4_INTERL2-NEXT:    br label %vector.body
50; VEC4_INTERL2:       vector.body:
51; VEC4_INTERL2-NEXT:    [[INDEX:%.*]] = phi i64 [ 0, %vector.ph ], [ [[INDEX_NEXT:%.*]], %vector.body ]
52; VEC4_INTERL2-NEXT:    [[VEC_IND:%.*]] = phi <4 x float> [ [[INDUCTION5]], %vector.ph ], [ [[VEC_IND_NEXT:%.*]], %vector.body ]
53; VEC4_INTERL2-NEXT:    [[STEP_ADD:%.*]] = fsub fast <4 x float> [[VEC_IND]], [[DOTSPLAT7]]
54; VEC4_INTERL2-NEXT:    [[TMP9:%.*]] = getelementptr inbounds float, float* %A, i64 [[INDEX]]
55; VEC4_INTERL2-NEXT:    [[TMP10:%.*]] = bitcast float* [[TMP9]] to <4 x float>*
56; VEC4_INTERL2-NEXT:    store <4 x float> [[VEC_IND]], <4 x float>* [[TMP10]], align 4
57; VEC4_INTERL2-NEXT:    [[TMP11:%.*]] = getelementptr inbounds float, float* [[TMP9]], i64 4
58; VEC4_INTERL2-NEXT:    [[TMP12:%.*]] = bitcast float* [[TMP11]] to <4 x float>*
59; VEC4_INTERL2-NEXT:    store <4 x float> [[STEP_ADD]], <4 x float>* [[TMP12]], align 4
60; VEC4_INTERL2-NEXT:    [[INDEX_NEXT]] = add i64 [[INDEX]], 8
61; VEC4_INTERL2-NEXT:    [[VEC_IND_NEXT]] = fsub fast <4 x float> [[STEP_ADD]], [[DOTSPLAT7]]
62; VEC4_INTERL2:         br i1 {{.*}}, label %middle.block, label %vector.body
63
64; VEC1_INTERL2-LABEL: @fp_iv_loop1(
65; VEC1_INTERL2:       vector.ph:
66; VEC1_INTERL2:         br label %vector.body
67; VEC1_INTERL2:       vector.body:
68; VEC1_INTERL2-NEXT:    [[INDEX:%.*]] = phi i64 [ 0, %vector.ph ], [ [[INDEX_NEXT:%.*]], %vector.body ]
69; VEC1_INTERL2-NEXT:    [[INDUCTION2:%.*]] = or i64 [[INDEX]], 1
70; VEC1_INTERL2-NEXT:    [[TMP6:%.*]] = sitofp i64 [[INDEX]] to float
71; VEC1_INTERL2-NEXT:    [[TMP7:%.*]] = fmul fast float %fpinc, [[TMP6]]
72; VEC1_INTERL2-NEXT:    [[FP_OFFSET_IDX:%.*]] = fsub fast float %init, [[TMP7]]
73; VEC1_INTERL2-NEXT:    [[TMP8:%.*]] = fsub fast float [[FP_OFFSET_IDX]], %fpinc
74; VEC1_INTERL2-NEXT:    [[TMP9:%.*]] = getelementptr inbounds float, float* %A, i64 [[INDEX]]
75; VEC1_INTERL2-NEXT:    [[TMP10:%.*]] = getelementptr inbounds float, float* %A, i64 [[INDUCTION2]]
76; VEC1_INTERL2-NEXT:    store float [[FP_OFFSET_IDX]], float* [[TMP9]], align 4
77; VEC1_INTERL2-NEXT:    store float [[TMP8]], float* [[TMP10]], align 4
78; VEC1_INTERL2-NEXT:    [[INDEX_NEXT]] = add i64 [[INDEX]], 2
79; VEC1_INTERL2:         br i1 {{.*}}, label %middle.block, label %vector.body
80
81define void @fp_iv_loop1(float %init, float* noalias nocapture %A, i32 %N) #1 {
82entry:
83  %cmp4 = icmp sgt i32 %N, 0
84  br i1 %cmp4, label %for.body.lr.ph, label %for.end
85
86for.body.lr.ph:                                   ; preds = %entry
87  %fpinc = load float, float* @fp_inc, align 4
88  br label %for.body
89
90for.body:                                         ; preds = %for.body, %for.body.lr.ph
91  %indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
92  %x.05 = phi float [ %init, %for.body.lr.ph ], [ %add, %for.body ]
93  %arrayidx = getelementptr inbounds float, float* %A, i64 %indvars.iv
94  store float %x.05, float* %arrayidx, align 4
95  %add = fsub fast float %x.05, %fpinc
96  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
97  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
98  %exitcond = icmp eq i32 %lftr.wideiv, %N
99  br i1 %exitcond, label %for.end.loopexit, label %for.body
100
101for.end.loopexit:                                 ; preds = %for.body
102  br label %for.end
103
104for.end:                                          ; preds = %for.end.loopexit, %entry
105  ret void
106}
107
108;void fp_iv_loop2(float init, float * __restrict__ A, int N) {
109;  float x = init;
110;  for (int i=0; i < N; ++i) {
111;    A[i] = x;
112;    x += 0.5;
113;  }
114;}
115
116; VEC4_INTERL1-LABEL: @fp_iv_loop2(
117; VEC4_INTERL1:       vector.ph:
118; VEC4_INTERL1:         [[DOTSPLATINSERT:%.*]] = insertelement <4 x float> undef, float %init, i32 0
119; VEC4_INTERL1-NEXT:    [[DOTSPLAT:%.*]] = shufflevector <4 x float> [[DOTSPLATINSERT]], <4 x float> undef, <4 x i32> zeroinitializer
120; VEC4_INTERL1-NEXT:    [[INDUCTION2:%.*]] = fadd fast <4 x float> [[DOTSPLAT]], <float 0.000000e+00, float 5.000000e-01, float 1.000000e+00, float 1.500000e+00>
121; VEC4_INTERL1-NEXT:    br label %vector.body
122; VEC4_INTERL1:       vector.body:
123; VEC4_INTERL1-NEXT:    [[INDEX:%.*]] = phi i64 [ 0, %vector.ph ], [ [[INDEX_NEXT:%.*]], %vector.body ]
124; VEC4_INTERL1-NEXT:    [[VEC_IND:%.*]] = phi <4 x float> [ [[INDUCTION2]], %vector.ph ], [ [[VEC_IND_NEXT:%.*]], %vector.body ]
125; VEC4_INTERL1-NEXT:    [[TMP7:%.*]] = getelementptr inbounds float, float* %A, i64 [[INDEX]]
126; VEC4_INTERL1-NEXT:    [[TMP8:%.*]] = bitcast float* [[TMP7]] to <4 x float>*
127; VEC4_INTERL1-NEXT:    store <4 x float> [[VEC_IND]], <4 x float>* [[TMP8]], align 4
128; VEC4_INTERL1-NEXT:    [[INDEX_NEXT]] = add i64 [[INDEX]], 4
129; VEC4_INTERL1-NEXT:    [[VEC_IND_NEXT]] = fadd fast <4 x float> [[VEC_IND]], <float 2.000000e+00, float 2.000000e+00, float 2.000000e+00, float 2.000000e+00>
130; VEC4_INTERL1:         br i1 {{.*}}, label %middle.block, label %vector.body
131
132define void @fp_iv_loop2(float %init, float* noalias nocapture %A, i32 %N) #0 {
133entry:
134  %cmp4 = icmp sgt i32 %N, 0
135  br i1 %cmp4, label %for.body.preheader, label %for.end
136
137for.body.preheader:                               ; preds = %entry
138  br label %for.body
139
140for.body:                                         ; preds = %for.body.preheader, %for.body
141  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ]
142  %x.06 = phi float [ %conv1, %for.body ], [ %init, %for.body.preheader ]
143  %arrayidx = getelementptr inbounds float, float* %A, i64 %indvars.iv
144  store float %x.06, float* %arrayidx, align 4
145  %conv1 = fadd fast float %x.06, 5.000000e-01
146  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
147  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
148  %exitcond = icmp eq i32 %lftr.wideiv, %N
149  br i1 %exitcond, label %for.end.loopexit, label %for.body
150
151for.end.loopexit:                                 ; preds = %for.body
152  br label %for.end
153
154for.end:                                          ; preds = %for.end.loopexit, %entry
155  ret void
156}
157
158;void fp_iv_loop3(float init, float * __restrict__ A, float * __restrict__ B, float * __restrict__ C, int N) {
159;  int i = 0;
160;  float x = init;
161;  float y = 0.1;
162;  for (; i < N; ++i) {
163;    A[i] = x;
164;    x += fp_inc;
165;    y -= 0.5;
166;    B[i] = x + y;
167;    C[i] = y;
168;  }
169;}
170
171; VEC4_INTERL1-LABEL: @fp_iv_loop3(
172; VEC4_INTERL1:       for.body.lr.ph:
173; VEC4_INTERL1:         [[TMP0:%.*]] = load float, float* @fp_inc, align 4
174; VEC4_INTERL1:       vector.ph:
175; VEC4_INTERL1:         [[DOTSPLATINSERT:%.*]] = insertelement <4 x float> undef, float %init, i32 0
176; VEC4_INTERL1-NEXT:    [[DOTSPLAT:%.*]] = shufflevector <4 x float> [[DOTSPLATINSERT]], <4 x float> undef, <4 x i32> zeroinitializer
177; VEC4_INTERL1-NEXT:    [[DOTSPLATINSERT5:%.*]] = insertelement <4 x float> undef, float [[TMP0]], i32 0
178; VEC4_INTERL1-NEXT:    [[DOTSPLAT6:%.*]] = shufflevector <4 x float> [[DOTSPLATINSERT5]], <4 x float> undef, <4 x i32> zeroinitializer
179; VEC4_INTERL1-NEXT:    [[TMP7:%.*]] = fmul fast <4 x float> [[DOTSPLAT6]], <float 0.000000e+00, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00>
180; VEC4_INTERL1-NEXT:    [[INDUCTION7:%.*]] = fadd fast <4 x float> [[DOTSPLAT]], [[TMP7]]
181; VEC4_INTERL1-NEXT:    [[TMP8:%.*]] = fmul fast float [[TMP0]], 4.000000e+00
182; VEC4_INTERL1-NEXT:    [[DOTSPLATINSERT8:%.*]] = insertelement <4 x float> undef, float [[TMP8]], i32 0
183; VEC4_INTERL1-NEXT:    [[DOTSPLAT9:%.*]] = shufflevector <4 x float> [[DOTSPLATINSERT8]], <4 x float> undef, <4 x i32> zeroinitializer
184; VEC4_INTERL1-NEXT:    [[BROADCAST_SPLATINSERT12:%.*]] = insertelement <4 x float> undef, float [[TMP0]], i32 0
185; VEC4_INTERL1-NEXT:    [[BROADCAST_SPLAT13:%.*]] = shufflevector <4 x float> [[BROADCAST_SPLATINSERT12]], <4 x float> undef, <4 x i32> zeroinitializer
186; VEC4_INTERL1-NEXT:    br label [[VECTOR_BODY:%.*]]
187; VEC4_INTERL1:       vector.body:
188; VEC4_INTERL1-NEXT:    [[INDEX:%.*]] = phi i64 [ 0, %vector.ph ], [ [[INDEX_NEXT:%.*]], %vector.body ]
189; VEC4_INTERL1-NEXT:    [[VEC_IND:%.*]] = phi <4 x float> [ <float 0x3FB99999A0000000, float 0xBFD99999A0000000, float 0xBFECCCCCC0000000, float 0xBFF6666660000000>, %vector.ph ], [ [[VEC_IND_NEXT:%.*]], %vector.body ]
190; VEC4_INTERL1-NEXT:    [[VEC_IND10:%.*]] = phi <4 x float> [ [[INDUCTION7]], %vector.ph ], [ [[VEC_IND_NEXT11:%.*]], %vector.body ]
191; VEC4_INTERL1-NEXT:    [[TMP12:%.*]] = getelementptr inbounds float, float* %A, i64 [[INDEX]]
192; VEC4_INTERL1-NEXT:    [[TMP13:%.*]] = bitcast float* [[TMP12]] to <4 x float>*
193; VEC4_INTERL1-NEXT:    store <4 x float> [[VEC_IND10]], <4 x float>* [[TMP13]], align 4
194; VEC4_INTERL1-NEXT:    [[TMP14:%.*]] = fadd fast <4 x float> [[VEC_IND10]], [[BROADCAST_SPLAT13]]
195; VEC4_INTERL1-NEXT:    [[TMP15:%.*]] = fadd fast <4 x float> [[VEC_IND]], <float -5.000000e-01, float -5.000000e-01, float -5.000000e-01, float -5.000000e-01>
196; VEC4_INTERL1-NEXT:    [[TMP16:%.*]] = fadd fast <4 x float> [[TMP15]], [[TMP14]]
197; VEC4_INTERL1-NEXT:    [[TMP17:%.*]] = getelementptr inbounds float, float* %B, i64 [[INDEX]]
198; VEC4_INTERL1-NEXT:    [[TMP18:%.*]] = bitcast float* [[TMP17]] to <4 x float>*
199; VEC4_INTERL1-NEXT:    store <4 x float> [[TMP16]], <4 x float>* [[TMP18]], align 4
200; VEC4_INTERL1-NEXT:    [[TMP19:%.*]] = getelementptr inbounds float, float* %C, i64 [[INDEX]]
201; VEC4_INTERL1-NEXT:    [[TMP20:%.*]] = bitcast float* [[TMP19]] to <4 x float>*
202; VEC4_INTERL1-NEXT:    store <4 x float> [[TMP15]], <4 x float>* [[TMP20]], align 4
203; VEC4_INTERL1-NEXT:    [[INDEX_NEXT]] = add i64 [[INDEX]], 4
204; VEC4_INTERL1-NEXT:    [[VEC_IND_NEXT]] = fadd fast <4 x float> [[VEC_IND]], <float -2.000000e+00, float -2.000000e+00, float -2.000000e+00, float -2.000000e+00>
205; VEC4_INTERL1-NEXT:    [[VEC_IND_NEXT11]] = fadd fast <4 x float> [[VEC_IND10]], [[DOTSPLAT9]]
206; VEC4_INTERL1:         br i1 {{.*}}, label %middle.block, label %vector.body
207
208define void @fp_iv_loop3(float %init, float* noalias nocapture %A, float* noalias nocapture %B, float* noalias nocapture %C, i32 %N) #1 {
209entry:
210  %cmp9 = icmp sgt i32 %N, 0
211  br i1 %cmp9, label %for.body.lr.ph, label %for.end
212
213for.body.lr.ph:                                   ; preds = %entry
214  %0 = load float, float* @fp_inc, align 4
215  br label %for.body
216
217for.body:                                         ; preds = %for.body, %for.body.lr.ph
218  %indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
219  %y.012 = phi float [ 0x3FB99999A0000000, %for.body.lr.ph ], [ %conv1, %for.body ]
220  %x.011 = phi float [ %init, %for.body.lr.ph ], [ %add, %for.body ]
221  %arrayidx = getelementptr inbounds float, float* %A, i64 %indvars.iv
222  store float %x.011, float* %arrayidx, align 4
223  %add = fadd fast float %x.011, %0
224  %conv1 = fadd fast float %y.012, -5.000000e-01
225  %add2 = fadd fast float %conv1, %add
226  %arrayidx4 = getelementptr inbounds float, float* %B, i64 %indvars.iv
227  store float %add2, float* %arrayidx4, align 4
228  %arrayidx6 = getelementptr inbounds float, float* %C, i64 %indvars.iv
229  store float %conv1, float* %arrayidx6, align 4
230  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
231  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
232  %exitcond = icmp eq i32 %lftr.wideiv, %N
233  br i1 %exitcond, label %for.end.loopexit, label %for.body
234
235for.end.loopexit:
236  br label %for.end
237
238for.end:
239  ret void
240}
241
242; Start and step values are constants. There is no 'fmul' operation in this case
243;void fp_iv_loop4(float * __restrict__ A, int N) {
244;  float x = 1.0;
245;  for (int i=0; i < N; ++i) {
246;    A[i] = x;
247;    x += 0.5;
248;  }
249;}
250
251; VEC4_INTERL1-LABEL: @fp_iv_loop4(
252; VEC4_INTERL1:       vector.ph:
253; VEC4_INTERL1:         br label %vector.body
254; VEC4_INTERL1:       vector.body:
255; VEC4_INTERL1-NEXT:    [[INDEX:%.*]] = phi i64 [ 0, %vector.ph ], [ [[INDEX_NEXT:%.*]], %vector.body ]
256; VEC4_INTERL1-NEXT:    [[VEC_IND:%.*]] = phi <4 x float> [ <float 1.000000e+00, float 1.500000e+00, float 2.000000e+00, float 2.500000e+00>, %vector.ph ], [ [[VEC_IND_NEXT:%.*]], %vector.body ]
257; VEC4_INTERL1-NEXT:    [[TMP7:%.*]] = getelementptr inbounds float, float* %A, i64 [[INDEX]]
258; VEC4_INTERL1-NEXT:    [[TMP8:%.*]] = bitcast float* [[TMP7]] to <4 x float>*
259; VEC4_INTERL1-NEXT:    store <4 x float> [[VEC_IND]], <4 x float>* [[TMP8]], align 4
260; VEC4_INTERL1-NEXT:    [[INDEX_NEXT]] = add i64 [[INDEX]], 4
261; VEC4_INTERL1-NEXT:    [[VEC_IND_NEXT]] = fadd fast <4 x float> [[VEC_IND]], <float 2.000000e+00, float 2.000000e+00, float 2.000000e+00, float 2.000000e+00>
262; VEC4_INTERL1:         br i1 {{.*}}, label %middle.block, label %vector.body
263
264define void @fp_iv_loop4(float* noalias nocapture %A, i32 %N) {
265entry:
266  %cmp4 = icmp sgt i32 %N, 0
267  br i1 %cmp4, label %for.body.preheader, label %for.end
268
269for.body.preheader:                               ; preds = %entry
270  br label %for.body
271
272for.body:                                         ; preds = %for.body.preheader, %for.body
273  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ]
274  %x.06 = phi float [ %conv1, %for.body ], [ 1.000000e+00, %for.body.preheader ]
275  %arrayidx = getelementptr inbounds float, float* %A, i64 %indvars.iv
276  store float %x.06, float* %arrayidx, align 4
277  %conv1 = fadd fast float %x.06, 5.000000e-01
278  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
279  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
280  %exitcond = icmp eq i32 %lftr.wideiv, %N
281  br i1 %exitcond, label %for.end.loopexit, label %for.body
282
283for.end.loopexit:                                 ; preds = %for.body
284  br label %for.end
285
286for.end:                                          ; preds = %for.end.loopexit, %entry
287  ret void
288}
289
290; VEC2_INTERL1_PRED_STORE-LABEL: @non_primary_iv_float_scalar(
291; VEC2_INTERL1_PRED_STORE:       vector.body:
292; VEC2_INTERL1_PRED_STORE-NEXT:    [[INDEX:%.*]] = phi i64 [ 0, %vector.ph ], [ [[INDEX_NEXT:%.*]], %[[PRED_STORE_CONTINUE7:.*]] ]
293; VEC2_INTERL1_PRED_STORE-NEXT:    [[TMP1:%.*]] = sitofp i64 [[INDEX]] to float
294; VEC2_INTERL1_PRED_STORE-NEXT:    [[TMP2:%.*]] = getelementptr inbounds float, float* %A, i64 [[INDEX]]
295; VEC2_INTERL1_PRED_STORE-NEXT:    [[TMP3:%.*]] = bitcast float* [[TMP2]] to <2 x float>*
296; VEC2_INTERL1_PRED_STORE-NEXT:    [[WIDE_LOAD:%.*]] = load <2 x float>, <2 x float>* [[TMP3]], align 4
297; VEC2_INTERL1_PRED_STORE-NEXT:    [[TMP4:%.*]] = fcmp fast oeq <2 x float> [[WIDE_LOAD]], zeroinitializer
298; VEC2_INTERL1_PRED_STORE-NEXT:    [[TMP5:%.*]] = extractelement <2 x i1> [[TMP4]], i32 0
299; VEC2_INTERL1_PRED_STORE-NEXT:    br i1 [[TMP5]], label %[[PRED_STORE_IF:.*]], label %[[PRED_STORE_CONTINUE:.*]]
300; VEC2_INTERL1_PRED_STORE:       [[PRED_STORE_IF]]:
301; VEC2_INTERL1_PRED_STORE-NEXT:    store float [[TMP1]], float* [[TMP2]], align 4
302; VEC2_INTERL1_PRED_STORE-NEXT:    br label %[[PRED_STORE_CONTINUE]]
303; VEC2_INTERL1_PRED_STORE:       [[PRED_STORE_CONTINUE]]:
304; VEC2_INTERL1_PRED_STORE-NEXT:    [[TMP8:%.*]] = extractelement <2 x i1> [[TMP4]], i32 1
305; VEC2_INTERL1_PRED_STORE-NEXT:    br i1 [[TMP8]], label %[[PRED_STORE_IF6:.*]], label %[[PRED_STORE_CONTINUE7]]
306; VEC2_INTERL1_PRED_STORE:       [[PRED_STORE_IF6]]:
307; VEC2_INTERL1_PRED_STORE-NEXT:    [[TMP9:%.*]] = fadd fast float [[TMP1]], 1.000000e+00
308; VEC2_INTERL1_PRED_STORE-NEXT:    [[TMP10:%.*]] = or i64 [[INDEX]], 1
309; VEC2_INTERL1_PRED_STORE-NEXT:    [[TMP11:%.*]] = getelementptr inbounds float, float* %A, i64 [[TMP10]]
310; VEC2_INTERL1_PRED_STORE-NEXT:    store float [[TMP9]], float* [[TMP11]], align 4
311; VEC2_INTERL1_PRED_STORE-NEXT:    br label %[[PRED_STORE_CONTINUE7]]
312; VEC2_INTERL1_PRED_STORE:       [[PRED_STORE_CONTINUE7]]:
313; VEC2_INTERL1_PRED_STORE-NEXT:    [[INDEX_NEXT]] = add i64 [[INDEX]], 2
314; VEC2_INTERL1_PRED_STORE:         br i1 {{.*}}, label %middle.block, label %vector.body
315
316define void @non_primary_iv_float_scalar(float* %A, i64 %N) {
317entry:
318  br label %for.body
319
320for.body:
321  %i = phi i64 [ %i.next, %for.inc ], [ 0, %entry ]
322  %j = phi float [ %j.next, %for.inc ], [ 0.0, %entry ]
323  %tmp0 = getelementptr inbounds float, float* %A, i64 %i
324  %tmp1 = load float, float* %tmp0, align 4
325  %tmp2 = fcmp fast oeq float %tmp1, 0.0
326  br i1 %tmp2, label %if.pred, label %for.inc
327
328if.pred:
329  store float %j, float* %tmp0, align 4
330  br label %for.inc
331
332for.inc:
333  %i.next = add nuw nsw i64 %i, 1
334  %j.next = fadd fast float %j, 1.0
335  %cond = icmp slt i64 %i.next, %N
336  br i1 %cond, label %for.body, label %for.end
337
338for.end:
339  ret void
340}
341