1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -loop-vectorize -S -mtriple=thumbv8.1m.main-none-none-eabi -mattr=+mve.fp,mve1beat -dce -instcombine --simplifycfg -tail-predication=disabled < %s | FileCheck %s
3
4target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
5target triple = "thumbv8.1m.main-none-none-eabi"
6
7define hidden void @pointer_phi_v4i32_add1(i32* noalias nocapture readonly %A, i32* noalias nocapture %B, i32 %s, i32%y) {
8; CHECK-LABEL: @pointer_phi_v4i32_add1(
9; CHECK-NEXT:  entry:
10; CHECK-NEXT:    [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x i32> undef, i32 [[Y:%.*]], i32 0
11; CHECK-NEXT:    [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT]], <4 x i32> undef, <4 x i32> zeroinitializer
12; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]
13; CHECK:       vector.body:
14; CHECK-NEXT:    [[INDEX:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
15; CHECK-NEXT:    [[NEXT_GEP:%.*]] = getelementptr i32, i32* [[A:%.*]], i32 [[INDEX]]
16; CHECK-NEXT:    [[NEXT_GEP4:%.*]] = getelementptr i32, i32* [[B:%.*]], i32 [[INDEX]]
17; CHECK-NEXT:    [[TMP0:%.*]] = bitcast i32* [[NEXT_GEP]] to <4 x i32>*
18; CHECK-NEXT:    [[WIDE_LOAD:%.*]] = load <4 x i32>, <4 x i32>* [[TMP0]], align 4
19; CHECK-NEXT:    [[TMP1:%.*]] = add nsw <4 x i32> [[WIDE_LOAD]], [[BROADCAST_SPLAT]]
20; CHECK-NEXT:    [[TMP2:%.*]] = bitcast i32* [[NEXT_GEP4]] to <4 x i32>*
21; CHECK-NEXT:    store <4 x i32> [[TMP1]], <4 x i32>* [[TMP2]], align 4
22; CHECK-NEXT:    [[INDEX_NEXT]] = add i32 [[INDEX]], 4
23; CHECK-NEXT:    [[TMP3:%.*]] = icmp eq i32 [[INDEX_NEXT]], 1000
24; CHECK-NEXT:    br i1 [[TMP3]], label [[END:%.*]], label [[VECTOR_BODY]], [[LOOP0:!llvm.loop !.*]]
25; CHECK:       end:
26; CHECK-NEXT:    ret void
27;
28entry:
29  br label %for.body
30for.body:
31  %A.addr.09 = phi i32* [ %add.ptr, %for.body ], [ %A, %entry ]
32  %i.08 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
33  %B.addr.07 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
34  %0 = load i32, i32* %A.addr.09, align 4
35  %add.ptr = getelementptr inbounds i32, i32* %A.addr.09, i32 1
36  %add = add nsw i32 %0, %y
37  store i32 %add, i32* %B.addr.07, align 4
38  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.07, i32 1
39  %inc = add nuw nsw i32 %i.08, 1
40  %exitcond = icmp eq i32 %inc, 1000
41  br i1 %exitcond, label %end, label %for.body
42end:
43  ret void
44}
45
46define hidden void @pointer_phi_v4i32_add2(i32* noalias nocapture readonly %A, i32* noalias nocapture %B, i32 %y) {
47; CHECK-LABEL: @pointer_phi_v4i32_add2(
48; CHECK-NEXT:  entry:
49; CHECK-NEXT:    [[IND_END:%.*]] = getelementptr i32, i32* [[A:%.*]], i32 1992
50; CHECK-NEXT:    [[IND_END3:%.*]] = getelementptr i32, i32* [[B:%.*]], i32 996
51; CHECK-NEXT:    [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x i32> undef, i32 [[Y:%.*]], i32 0
52; CHECK-NEXT:    [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT]], <4 x i32> undef, <4 x i32> zeroinitializer
53; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]
54; CHECK:       vector.body:
55; CHECK-NEXT:    [[INDEX:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
56; CHECK-NEXT:    [[TMP0:%.*]] = shl i32 [[INDEX]], 1
57; CHECK-NEXT:    [[NEXT_GEP:%.*]] = getelementptr i32, i32* [[A]], i32 [[TMP0]]
58; CHECK-NEXT:    [[NEXT_GEP4:%.*]] = getelementptr i32, i32* [[B]], i32 [[INDEX]]
59; CHECK-NEXT:    [[TMP1:%.*]] = bitcast i32* [[NEXT_GEP]] to <8 x i32>*
60; CHECK-NEXT:    [[WIDE_VEC:%.*]] = load <8 x i32>, <8 x i32>* [[TMP1]], align 4
61; CHECK-NEXT:    [[STRIDED_VEC:%.*]] = shufflevector <8 x i32> [[WIDE_VEC]], <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
62; CHECK-NEXT:    [[TMP2:%.*]] = add nsw <4 x i32> [[STRIDED_VEC]], [[BROADCAST_SPLAT]]
63; CHECK-NEXT:    [[TMP3:%.*]] = bitcast i32* [[NEXT_GEP4]] to <4 x i32>*
64; CHECK-NEXT:    store <4 x i32> [[TMP2]], <4 x i32>* [[TMP3]], align 4
65; CHECK-NEXT:    [[INDEX_NEXT]] = add i32 [[INDEX]], 4
66; CHECK-NEXT:    [[TMP4:%.*]] = icmp eq i32 [[INDEX_NEXT]], 996
67; CHECK-NEXT:    br i1 [[TMP4]], label [[FOR_BODY:%.*]], label [[VECTOR_BODY]], [[LOOP2:!llvm.loop !.*]]
68; CHECK:       for.body:
69; CHECK-NEXT:    [[A_ADDR_09:%.*]] = phi i32* [ [[ADD_PTR:%.*]], [[FOR_BODY]] ], [ [[IND_END]], [[VECTOR_BODY]] ]
70; CHECK-NEXT:    [[I_08:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ 996, [[VECTOR_BODY]] ]
71; CHECK-NEXT:    [[B_ADDR_07:%.*]] = phi i32* [ [[INCDEC_PTR:%.*]], [[FOR_BODY]] ], [ [[IND_END3]], [[VECTOR_BODY]] ]
72; CHECK-NEXT:    [[TMP5:%.*]] = load i32, i32* [[A_ADDR_09]], align 4
73; CHECK-NEXT:    [[ADD_PTR]] = getelementptr inbounds i32, i32* [[A_ADDR_09]], i32 2
74; CHECK-NEXT:    [[ADD:%.*]] = add nsw i32 [[TMP5]], [[Y]]
75; CHECK-NEXT:    store i32 [[ADD]], i32* [[B_ADDR_07]], align 4
76; CHECK-NEXT:    [[INCDEC_PTR]] = getelementptr inbounds i32, i32* [[B_ADDR_07]], i32 1
77; CHECK-NEXT:    [[INC]] = add nuw nsw i32 [[I_08]], 1
78; CHECK-NEXT:    [[EXITCOND:%.*]] = icmp eq i32 [[INC]], 1000
79; CHECK-NEXT:    br i1 [[EXITCOND]], label [[END:%.*]], label [[FOR_BODY]], [[LOOP3:!llvm.loop !.*]]
80; CHECK:       end:
81; CHECK-NEXT:    ret void
82;
83entry:
84  br label %for.body
85for.body:
86  %A.addr.09 = phi i32* [ %add.ptr, %for.body ], [ %A, %entry ]
87  %i.08 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
88  %B.addr.07 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
89  %0 = load i32, i32* %A.addr.09, align 4
90  %add.ptr = getelementptr inbounds i32, i32* %A.addr.09, i32 2
91  %add = add nsw i32 %0, %y
92  store i32 %add, i32* %B.addr.07, align 4
93  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.07, i32 1
94  %inc = add nuw nsw i32 %i.08, 1
95  %exitcond = icmp eq i32 %inc, 1000
96  br i1 %exitcond, label %end, label %for.body
97end:
98  ret void
99}
100
101define hidden void @pointer_phi_v4i32_add3(i32* noalias nocapture readonly %A, i32* noalias nocapture %B, i32 %y) {
102; CHECK-LABEL: @pointer_phi_v4i32_add3(
103; CHECK-NEXT:  entry:
104; CHECK-NEXT:    [[IND_END:%.*]] = getelementptr i32, i32* [[A:%.*]], i32 2988
105; CHECK-NEXT:    [[IND_END3:%.*]] = getelementptr i32, i32* [[B:%.*]], i32 996
106; CHECK-NEXT:    [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x i32> undef, i32 [[Y:%.*]], i32 0
107; CHECK-NEXT:    [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT]], <4 x i32> undef, <4 x i32> zeroinitializer
108; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]
109; CHECK:       vector.body:
110; CHECK-NEXT:    [[POINTER_PHI:%.*]] = phi i32* [ [[A]], [[ENTRY:%.*]] ], [ [[PTR_IND:%.*]], [[VECTOR_BODY]] ]
111; CHECK-NEXT:    [[INDEX:%.*]] = phi i32 [ 0, [[ENTRY]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
112; CHECK-NEXT:    [[TMP0:%.*]] = getelementptr i32, i32* [[POINTER_PHI]], <4 x i32> <i32 0, i32 3, i32 6, i32 9>
113; CHECK-NEXT:    [[NEXT_GEP:%.*]] = getelementptr i32, i32* [[B]], i32 [[INDEX]]
114; CHECK-NEXT:    [[WIDE_MASKED_GATHER:%.*]] = call <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*> [[TMP0]], i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i32> undef)
115; CHECK-NEXT:    [[TMP1:%.*]] = add nsw <4 x i32> [[WIDE_MASKED_GATHER]], [[BROADCAST_SPLAT]]
116; CHECK-NEXT:    [[TMP2:%.*]] = bitcast i32* [[NEXT_GEP]] to <4 x i32>*
117; CHECK-NEXT:    store <4 x i32> [[TMP1]], <4 x i32>* [[TMP2]], align 4
118; CHECK-NEXT:    [[INDEX_NEXT]] = add i32 [[INDEX]], 4
119; CHECK-NEXT:    [[TMP3:%.*]] = icmp eq i32 [[INDEX_NEXT]], 996
120; CHECK-NEXT:    [[PTR_IND]] = getelementptr i32, i32* [[POINTER_PHI]], i32 12
121; CHECK-NEXT:    br i1 [[TMP3]], label [[FOR_BODY:%.*]], label [[VECTOR_BODY]], [[LOOP5:!llvm.loop !.*]]
122; CHECK:       for.body:
123; CHECK-NEXT:    [[A_ADDR_09:%.*]] = phi i32* [ [[ADD_PTR:%.*]], [[FOR_BODY]] ], [ [[IND_END]], [[VECTOR_BODY]] ]
124; CHECK-NEXT:    [[I_08:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ 996, [[VECTOR_BODY]] ]
125; CHECK-NEXT:    [[B_ADDR_07:%.*]] = phi i32* [ [[INCDEC_PTR:%.*]], [[FOR_BODY]] ], [ [[IND_END3]], [[VECTOR_BODY]] ]
126; CHECK-NEXT:    [[TMP4:%.*]] = load i32, i32* [[A_ADDR_09]], align 4
127; CHECK-NEXT:    [[ADD_PTR]] = getelementptr inbounds i32, i32* [[A_ADDR_09]], i32 3
128; CHECK-NEXT:    [[ADD:%.*]] = add nsw i32 [[TMP4]], [[Y]]
129; CHECK-NEXT:    store i32 [[ADD]], i32* [[B_ADDR_07]], align 4
130; CHECK-NEXT:    [[INCDEC_PTR]] = getelementptr inbounds i32, i32* [[B_ADDR_07]], i32 1
131; CHECK-NEXT:    [[INC]] = add nuw nsw i32 [[I_08]], 1
132; CHECK-NEXT:    [[EXITCOND:%.*]] = icmp eq i32 [[INC]], 1000
133; CHECK-NEXT:    br i1 [[EXITCOND]], label [[END:%.*]], label [[FOR_BODY]], [[LOOP6:!llvm.loop !.*]]
134; CHECK:       end:
135; CHECK-NEXT:    ret void
136;
137entry:
138  br label %for.body
139for.body:
140  %A.addr.09 = phi i32* [ %add.ptr, %for.body ], [ %A, %entry ]
141  %i.08 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
142  %B.addr.07 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %entry ]
143  %0 = load i32, i32* %A.addr.09, align 4
144  %add.ptr = getelementptr inbounds i32, i32* %A.addr.09, i32 3
145  %add = add nsw i32 %0, %y
146  store i32 %add, i32* %B.addr.07, align 4
147  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.07, i32 1
148  %inc = add nuw nsw i32 %i.08, 1
149  %exitcond = icmp eq i32 %inc, 1000
150  br i1 %exitcond, label %end, label %for.body
151end:
152  ret void
153}
154
155define hidden void @pointer_phi_v8i16_add1(i16* noalias nocapture readonly %A, i16* noalias nocapture %B, i32 %y) {
156; CHECK-LABEL: @pointer_phi_v8i16_add1(
157; CHECK-NEXT:  entry:
158; CHECK-NEXT:    [[TMP0:%.*]] = trunc i32 [[Y:%.*]] to i16
159; CHECK-NEXT:    [[BROADCAST_SPLATINSERT:%.*]] = insertelement <8 x i16> undef, i16 [[TMP0]], i32 0
160; CHECK-NEXT:    [[BROADCAST_SPLAT:%.*]] = shufflevector <8 x i16> [[BROADCAST_SPLATINSERT]], <8 x i16> undef, <8 x i32> zeroinitializer
161; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]
162; CHECK:       vector.body:
163; CHECK-NEXT:    [[INDEX:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
164; CHECK-NEXT:    [[NEXT_GEP:%.*]] = getelementptr i16, i16* [[A:%.*]], i32 [[INDEX]]
165; CHECK-NEXT:    [[NEXT_GEP4:%.*]] = getelementptr i16, i16* [[B:%.*]], i32 [[INDEX]]
166; CHECK-NEXT:    [[TMP1:%.*]] = bitcast i16* [[NEXT_GEP]] to <8 x i16>*
167; CHECK-NEXT:    [[WIDE_LOAD:%.*]] = load <8 x i16>, <8 x i16>* [[TMP1]], align 2
168; CHECK-NEXT:    [[TMP2:%.*]] = add <8 x i16> [[WIDE_LOAD]], [[BROADCAST_SPLAT]]
169; CHECK-NEXT:    [[TMP3:%.*]] = bitcast i16* [[NEXT_GEP4]] to <8 x i16>*
170; CHECK-NEXT:    store <8 x i16> [[TMP2]], <8 x i16>* [[TMP3]], align 2
171; CHECK-NEXT:    [[INDEX_NEXT]] = add i32 [[INDEX]], 8
172; CHECK-NEXT:    [[TMP4:%.*]] = icmp eq i32 [[INDEX_NEXT]], 1000
173; CHECK-NEXT:    br i1 [[TMP4]], label [[END:%.*]], label [[VECTOR_BODY]], [[LOOP7:!llvm.loop !.*]]
174; CHECK:       end:
175; CHECK-NEXT:    ret void
176;
177entry:
178  %0 = trunc i32 %y to i16
179  br label %for.body
180for.body:                                         ; preds = %for.body, %for.body.lr.ph
181  %A.addr.011 = phi i16* [ %A, %entry ], [ %add.ptr, %for.body ]
182  %i.010 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
183  %B.addr.09 = phi i16* [ %B, %entry ], [ %incdec.ptr, %for.body ]
184  %l1 = load i16, i16* %A.addr.011, align 2
185  %add.ptr = getelementptr inbounds i16, i16* %A.addr.011, i32 1
186  %conv1 = add i16 %l1, %0
187  store i16 %conv1, i16* %B.addr.09, align 2
188  %incdec.ptr = getelementptr inbounds i16, i16* %B.addr.09, i32 1
189  %inc = add nuw nsw i32 %i.010, 1
190  %exitcond = icmp eq i32 %inc, 1000
191  br i1 %exitcond, label %end, label %for.body
192end:
193  ret void
194}
195
196define hidden void @pointer_phi_v8i16_add2(i16* noalias nocapture readonly %A, i16* noalias nocapture %B, i32 %y) {
197; CHECK-LABEL: @pointer_phi_v8i16_add2(
198; CHECK-NEXT:  entry:
199; CHECK-NEXT:    [[TMP0:%.*]] = trunc i32 [[Y:%.*]] to i16
200; CHECK-NEXT:    [[IND_END:%.*]] = getelementptr i16, i16* [[A:%.*]], i32 1984
201; CHECK-NEXT:    [[IND_END3:%.*]] = getelementptr i16, i16* [[B:%.*]], i32 992
202; CHECK-NEXT:    [[BROADCAST_SPLATINSERT:%.*]] = insertelement <8 x i16> undef, i16 [[TMP0]], i32 0
203; CHECK-NEXT:    [[BROADCAST_SPLAT:%.*]] = shufflevector <8 x i16> [[BROADCAST_SPLATINSERT]], <8 x i16> undef, <8 x i32> zeroinitializer
204; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]
205; CHECK:       vector.body:
206; CHECK-NEXT:    [[INDEX:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
207; CHECK-NEXT:    [[TMP1:%.*]] = shl i32 [[INDEX]], 1
208; CHECK-NEXT:    [[NEXT_GEP:%.*]] = getelementptr i16, i16* [[A]], i32 [[TMP1]]
209; CHECK-NEXT:    [[NEXT_GEP4:%.*]] = getelementptr i16, i16* [[B]], i32 [[INDEX]]
210; CHECK-NEXT:    [[TMP2:%.*]] = bitcast i16* [[NEXT_GEP]] to <16 x i16>*
211; CHECK-NEXT:    [[WIDE_VEC:%.*]] = load <16 x i16>, <16 x i16>* [[TMP2]], align 2
212; CHECK-NEXT:    [[STRIDED_VEC:%.*]] = shufflevector <16 x i16> [[WIDE_VEC]], <16 x i16> undef, <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14>
213; CHECK-NEXT:    [[TMP3:%.*]] = add <8 x i16> [[STRIDED_VEC]], [[BROADCAST_SPLAT]]
214; CHECK-NEXT:    [[TMP4:%.*]] = bitcast i16* [[NEXT_GEP4]] to <8 x i16>*
215; CHECK-NEXT:    store <8 x i16> [[TMP3]], <8 x i16>* [[TMP4]], align 2
216; CHECK-NEXT:    [[INDEX_NEXT]] = add i32 [[INDEX]], 8
217; CHECK-NEXT:    [[TMP5:%.*]] = icmp eq i32 [[INDEX_NEXT]], 992
218; CHECK-NEXT:    br i1 [[TMP5]], label [[FOR_BODY:%.*]], label [[VECTOR_BODY]], [[LOOP8:!llvm.loop !.*]]
219; CHECK:       for.body:
220; CHECK-NEXT:    [[A_ADDR_011:%.*]] = phi i16* [ [[ADD_PTR:%.*]], [[FOR_BODY]] ], [ [[IND_END]], [[VECTOR_BODY]] ]
221; CHECK-NEXT:    [[I_010:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ 992, [[VECTOR_BODY]] ]
222; CHECK-NEXT:    [[B_ADDR_09:%.*]] = phi i16* [ [[INCDEC_PTR:%.*]], [[FOR_BODY]] ], [ [[IND_END3]], [[VECTOR_BODY]] ]
223; CHECK-NEXT:    [[L1:%.*]] = load i16, i16* [[A_ADDR_011]], align 2
224; CHECK-NEXT:    [[ADD_PTR]] = getelementptr inbounds i16, i16* [[A_ADDR_011]], i32 2
225; CHECK-NEXT:    [[CONV1:%.*]] = add i16 [[L1]], [[TMP0]]
226; CHECK-NEXT:    store i16 [[CONV1]], i16* [[B_ADDR_09]], align 2
227; CHECK-NEXT:    [[INCDEC_PTR]] = getelementptr inbounds i16, i16* [[B_ADDR_09]], i32 1
228; CHECK-NEXT:    [[INC]] = add nuw nsw i32 [[I_010]], 1
229; CHECK-NEXT:    [[EXITCOND:%.*]] = icmp eq i32 [[INC]], 1000
230; CHECK-NEXT:    br i1 [[EXITCOND]], label [[END:%.*]], label [[FOR_BODY]], [[LOOP9:!llvm.loop !.*]]
231; CHECK:       end:
232; CHECK-NEXT:    ret void
233;
234entry:
235  %0 = trunc i32 %y to i16
236  br label %for.body
237for.body:                                         ; preds = %for.body, %for.body.lr.ph
238  %A.addr.011 = phi i16* [ %A, %entry ], [ %add.ptr, %for.body ]
239  %i.010 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
240  %B.addr.09 = phi i16* [ %B, %entry ], [ %incdec.ptr, %for.body ]
241  %l1 = load i16, i16* %A.addr.011, align 2
242  %add.ptr = getelementptr inbounds i16, i16* %A.addr.011, i32 2
243  %conv1 = add i16 %l1, %0
244  store i16 %conv1, i16* %B.addr.09, align 2
245  %incdec.ptr = getelementptr inbounds i16, i16* %B.addr.09, i32 1
246  %inc = add nuw nsw i32 %i.010, 1
247  %exitcond = icmp eq i32 %inc, 1000
248  br i1 %exitcond, label %end, label %for.body
249end:
250  ret void
251}
252
253define hidden void @pointer_phi_v8i16_add3(i16* noalias nocapture readonly %A, i16* noalias nocapture %B, i32 %y) {
254; CHECK-LABEL: @pointer_phi_v8i16_add3(
255; CHECK-NEXT:  entry:
256; CHECK-NEXT:    [[TMP0:%.*]] = trunc i32 [[Y:%.*]] to i16
257; CHECK-NEXT:    br label [[FOR_BODY:%.*]]
258; CHECK:       for.body:
259; CHECK-NEXT:    [[A_ADDR_011:%.*]] = phi i16* [ [[A:%.*]], [[ENTRY:%.*]] ], [ [[ADD_PTR:%.*]], [[FOR_BODY]] ]
260; CHECK-NEXT:    [[I_010:%.*]] = phi i32 [ 0, [[ENTRY]] ], [ [[INC:%.*]], [[FOR_BODY]] ]
261; CHECK-NEXT:    [[B_ADDR_09:%.*]] = phi i16* [ [[B:%.*]], [[ENTRY]] ], [ [[INCDEC_PTR:%.*]], [[FOR_BODY]] ]
262; CHECK-NEXT:    [[L1:%.*]] = load i16, i16* [[A_ADDR_011]], align 2
263; CHECK-NEXT:    [[ADD_PTR]] = getelementptr inbounds i16, i16* [[A_ADDR_011]], i32 3
264; CHECK-NEXT:    [[CONV1:%.*]] = add i16 [[L1]], [[TMP0]]
265; CHECK-NEXT:    store i16 [[CONV1]], i16* [[B_ADDR_09]], align 2
266; CHECK-NEXT:    [[INCDEC_PTR]] = getelementptr inbounds i16, i16* [[B_ADDR_09]], i32 1
267; CHECK-NEXT:    [[INC]] = add nuw nsw i32 [[I_010]], 1
268; CHECK-NEXT:    [[EXITCOND:%.*]] = icmp eq i32 [[INC]], 1000
269; CHECK-NEXT:    br i1 [[EXITCOND]], label [[END:%.*]], label [[FOR_BODY]]
270; CHECK:       end:
271; CHECK-NEXT:    ret void
272;
273entry:
274  %0 = trunc i32 %y to i16
275  br label %for.body
276for.body:                                         ; preds = %for.body, %for.body.lr.ph
277  %A.addr.011 = phi i16* [ %A, %entry ], [ %add.ptr, %for.body ]
278  %i.010 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
279  %B.addr.09 = phi i16* [ %B, %entry ], [ %incdec.ptr, %for.body ]
280  %l1 = load i16, i16* %A.addr.011, align 2
281  %add.ptr = getelementptr inbounds i16, i16* %A.addr.011, i32 3
282  %conv1 = add i16 %l1, %0
283  store i16 %conv1, i16* %B.addr.09, align 2
284  %incdec.ptr = getelementptr inbounds i16, i16* %B.addr.09, i32 1
285  %inc = add nuw nsw i32 %i.010, 1
286  %exitcond = icmp eq i32 %inc, 1000
287  br i1 %exitcond, label %end, label %for.body
288end:
289  ret void
290}
291
292define hidden void @pointer_phi_v16i8_add1(i8* noalias nocapture readonly %A, i8* noalias nocapture %B, i32 %y) {
293; CHECK-LABEL: @pointer_phi_v16i8_add1(
294; CHECK-NEXT:  entry:
295; CHECK-NEXT:    [[TMP0:%.*]] = trunc i32 [[Y:%.*]] to i8
296; CHECK-NEXT:    [[IND_END:%.*]] = getelementptr i8, i8* [[A:%.*]], i32 992
297; CHECK-NEXT:    [[IND_END3:%.*]] = getelementptr i8, i8* [[B:%.*]], i32 992
298; CHECK-NEXT:    [[BROADCAST_SPLATINSERT:%.*]] = insertelement <16 x i8> undef, i8 [[TMP0]], i32 0
299; CHECK-NEXT:    [[BROADCAST_SPLAT:%.*]] = shufflevector <16 x i8> [[BROADCAST_SPLATINSERT]], <16 x i8> undef, <16 x i32> zeroinitializer
300; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]
301; CHECK:       vector.body:
302; CHECK-NEXT:    [[INDEX:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
303; CHECK-NEXT:    [[NEXT_GEP:%.*]] = getelementptr i8, i8* [[A]], i32 [[INDEX]]
304; CHECK-NEXT:    [[NEXT_GEP4:%.*]] = getelementptr i8, i8* [[B]], i32 [[INDEX]]
305; CHECK-NEXT:    [[TMP1:%.*]] = bitcast i8* [[NEXT_GEP]] to <16 x i8>*
306; CHECK-NEXT:    [[WIDE_LOAD:%.*]] = load <16 x i8>, <16 x i8>* [[TMP1]], align 1
307; CHECK-NEXT:    [[TMP2:%.*]] = add <16 x i8> [[WIDE_LOAD]], [[BROADCAST_SPLAT]]
308; CHECK-NEXT:    [[TMP3:%.*]] = bitcast i8* [[NEXT_GEP4]] to <16 x i8>*
309; CHECK-NEXT:    store <16 x i8> [[TMP2]], <16 x i8>* [[TMP3]], align 1
310; CHECK-NEXT:    [[INDEX_NEXT]] = add i32 [[INDEX]], 16
311; CHECK-NEXT:    [[TMP4:%.*]] = icmp eq i32 [[INDEX_NEXT]], 992
312; CHECK-NEXT:    br i1 [[TMP4]], label [[FOR_BODY:%.*]], label [[VECTOR_BODY]], [[LOOP10:!llvm.loop !.*]]
313; CHECK:       for.body:
314; CHECK-NEXT:    [[A_ADDR_010:%.*]] = phi i8* [ [[ADD_PTR:%.*]], [[FOR_BODY]] ], [ [[IND_END]], [[VECTOR_BODY]] ]
315; CHECK-NEXT:    [[I_09:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ 992, [[VECTOR_BODY]] ]
316; CHECK-NEXT:    [[B_ADDR_08:%.*]] = phi i8* [ [[INCDEC_PTR:%.*]], [[FOR_BODY]] ], [ [[IND_END3]], [[VECTOR_BODY]] ]
317; CHECK-NEXT:    [[TMP5:%.*]] = load i8, i8* [[A_ADDR_010]], align 1
318; CHECK-NEXT:    [[ADD_PTR]] = getelementptr inbounds i8, i8* [[A_ADDR_010]], i32 1
319; CHECK-NEXT:    [[CONV1:%.*]] = add i8 [[TMP5]], [[TMP0]]
320; CHECK-NEXT:    store i8 [[CONV1]], i8* [[B_ADDR_08]], align 1
321; CHECK-NEXT:    [[INCDEC_PTR]] = getelementptr inbounds i8, i8* [[B_ADDR_08]], i32 1
322; CHECK-NEXT:    [[INC]] = add nuw nsw i32 [[I_09]], 1
323; CHECK-NEXT:    [[EXITCOND:%.*]] = icmp eq i32 [[INC]], 1000
324; CHECK-NEXT:    br i1 [[EXITCOND]], label [[END:%.*]], label [[FOR_BODY]], [[LOOP11:!llvm.loop !.*]]
325; CHECK:       end:
326; CHECK-NEXT:    ret void
327;
328entry:
329  %0 = trunc i32 %y to i8
330  br label %for.body
331
332for.body:
333  %A.addr.010 = phi i8* [ %A, %entry ], [ %add.ptr, %for.body ]
334  %i.09 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
335  %B.addr.08 = phi i8* [ %B, %entry ], [ %incdec.ptr, %for.body ]
336  %1 = load i8, i8* %A.addr.010, align 1
337  %add.ptr = getelementptr inbounds i8, i8* %A.addr.010, i32 1
338  %conv1 = add i8 %1, %0
339  store i8 %conv1, i8* %B.addr.08, align 1
340  %incdec.ptr = getelementptr inbounds i8, i8* %B.addr.08, i32 1
341  %inc = add nuw nsw i32 %i.09, 1
342  %exitcond = icmp eq i32 %inc, 1000
343  br i1 %exitcond, label %end, label %for.body
344end:
345  ret void
346}
347
348define hidden void @pointer_phi_v16i8_add2(i8* noalias nocapture readonly %A, i8* noalias nocapture %B, i32 %y) {
349; CHECK-LABEL: @pointer_phi_v16i8_add2(
350; CHECK-NEXT:  entry:
351; CHECK-NEXT:    [[TMP0:%.*]] = trunc i32 [[Y:%.*]] to i8
352; CHECK-NEXT:    [[IND_END:%.*]] = getelementptr i8, i8* [[A:%.*]], i32 1984
353; CHECK-NEXT:    [[IND_END3:%.*]] = getelementptr i8, i8* [[B:%.*]], i32 992
354; CHECK-NEXT:    [[BROADCAST_SPLATINSERT:%.*]] = insertelement <16 x i8> undef, i8 [[TMP0]], i32 0
355; CHECK-NEXT:    [[BROADCAST_SPLAT:%.*]] = shufflevector <16 x i8> [[BROADCAST_SPLATINSERT]], <16 x i8> undef, <16 x i32> zeroinitializer
356; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]
357; CHECK:       vector.body:
358; CHECK-NEXT:    [[INDEX:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
359; CHECK-NEXT:    [[TMP1:%.*]] = shl i32 [[INDEX]], 1
360; CHECK-NEXT:    [[NEXT_GEP:%.*]] = getelementptr i8, i8* [[A]], i32 [[TMP1]]
361; CHECK-NEXT:    [[NEXT_GEP4:%.*]] = getelementptr i8, i8* [[B]], i32 [[INDEX]]
362; CHECK-NEXT:    [[TMP2:%.*]] = bitcast i8* [[NEXT_GEP]] to <32 x i8>*
363; CHECK-NEXT:    [[WIDE_VEC:%.*]] = load <32 x i8>, <32 x i8>* [[TMP2]], align 1
364; CHECK-NEXT:    [[STRIDED_VEC:%.*]] = shufflevector <32 x i8> [[WIDE_VEC]], <32 x i8> undef, <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14, i32 16, i32 18, i32 20, i32 22, i32 24, i32 26, i32 28, i32 30>
365; CHECK-NEXT:    [[TMP3:%.*]] = add <16 x i8> [[STRIDED_VEC]], [[BROADCAST_SPLAT]]
366; CHECK-NEXT:    [[TMP4:%.*]] = bitcast i8* [[NEXT_GEP4]] to <16 x i8>*
367; CHECK-NEXT:    store <16 x i8> [[TMP3]], <16 x i8>* [[TMP4]], align 1
368; CHECK-NEXT:    [[INDEX_NEXT]] = add i32 [[INDEX]], 16
369; CHECK-NEXT:    [[TMP5:%.*]] = icmp eq i32 [[INDEX_NEXT]], 992
370; CHECK-NEXT:    br i1 [[TMP5]], label [[FOR_BODY:%.*]], label [[VECTOR_BODY]], [[LOOP12:!llvm.loop !.*]]
371; CHECK:       for.body:
372; CHECK-NEXT:    [[A_ADDR_010:%.*]] = phi i8* [ [[ADD_PTR:%.*]], [[FOR_BODY]] ], [ [[IND_END]], [[VECTOR_BODY]] ]
373; CHECK-NEXT:    [[I_09:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ 992, [[VECTOR_BODY]] ]
374; CHECK-NEXT:    [[B_ADDR_08:%.*]] = phi i8* [ [[INCDEC_PTR:%.*]], [[FOR_BODY]] ], [ [[IND_END3]], [[VECTOR_BODY]] ]
375; CHECK-NEXT:    [[TMP6:%.*]] = load i8, i8* [[A_ADDR_010]], align 1
376; CHECK-NEXT:    [[ADD_PTR]] = getelementptr inbounds i8, i8* [[A_ADDR_010]], i32 2
377; CHECK-NEXT:    [[CONV1:%.*]] = add i8 [[TMP6]], [[TMP0]]
378; CHECK-NEXT:    store i8 [[CONV1]], i8* [[B_ADDR_08]], align 1
379; CHECK-NEXT:    [[INCDEC_PTR]] = getelementptr inbounds i8, i8* [[B_ADDR_08]], i32 1
380; CHECK-NEXT:    [[INC]] = add nuw nsw i32 [[I_09]], 1
381; CHECK-NEXT:    [[EXITCOND:%.*]] = icmp eq i32 [[INC]], 1000
382; CHECK-NEXT:    br i1 [[EXITCOND]], label [[END:%.*]], label [[FOR_BODY]], [[LOOP13:!llvm.loop !.*]]
383; CHECK:       end:
384; CHECK-NEXT:    ret void
385;
386entry:
387  %0 = trunc i32 %y to i8
388  br label %for.body
389
390for.body:
391  %A.addr.010 = phi i8* [ %A, %entry ], [ %add.ptr, %for.body ]
392  %i.09 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
393  %B.addr.08 = phi i8* [ %B, %entry ], [ %incdec.ptr, %for.body ]
394  %1 = load i8, i8* %A.addr.010, align 1
395  %add.ptr = getelementptr inbounds i8, i8* %A.addr.010, i32 2
396  %conv1 = add i8 %1, %0
397  store i8 %conv1, i8* %B.addr.08, align 1
398  %incdec.ptr = getelementptr inbounds i8, i8* %B.addr.08, i32 1
399  %inc = add nuw nsw i32 %i.09, 1
400  %exitcond = icmp eq i32 %inc, 1000
401  br i1 %exitcond, label %end, label %for.body
402end:
403  ret void
404}
405
406define hidden void @pointer_phi_v16i8_add3(i8* noalias nocapture readonly %A, i8* noalias nocapture %B, i32 %y) {
407; CHECK-LABEL: @pointer_phi_v16i8_add3(
408; CHECK-NEXT:  entry:
409; CHECK-NEXT:    [[TMP0:%.*]] = trunc i32 [[Y:%.*]] to i8
410; CHECK-NEXT:    br label [[FOR_BODY:%.*]]
411; CHECK:       for.body:
412; CHECK-NEXT:    [[A_ADDR_010:%.*]] = phi i8* [ [[A:%.*]], [[ENTRY:%.*]] ], [ [[ADD_PTR:%.*]], [[FOR_BODY]] ]
413; CHECK-NEXT:    [[I_09:%.*]] = phi i32 [ 0, [[ENTRY]] ], [ [[INC:%.*]], [[FOR_BODY]] ]
414; CHECK-NEXT:    [[B_ADDR_08:%.*]] = phi i8* [ [[B:%.*]], [[ENTRY]] ], [ [[INCDEC_PTR:%.*]], [[FOR_BODY]] ]
415; CHECK-NEXT:    [[TMP1:%.*]] = load i8, i8* [[A_ADDR_010]], align 1
416; CHECK-NEXT:    [[ADD_PTR]] = getelementptr inbounds i8, i8* [[A_ADDR_010]], i32 3
417; CHECK-NEXT:    [[CONV1:%.*]] = add i8 [[TMP1]], [[TMP0]]
418; CHECK-NEXT:    store i8 [[CONV1]], i8* [[B_ADDR_08]], align 1
419; CHECK-NEXT:    [[INCDEC_PTR]] = getelementptr inbounds i8, i8* [[B_ADDR_08]], i32 1
420; CHECK-NEXT:    [[INC]] = add nuw nsw i32 [[I_09]], 1
421; CHECK-NEXT:    [[EXITCOND:%.*]] = icmp eq i32 [[INC]], 1000
422; CHECK-NEXT:    br i1 [[EXITCOND]], label [[END:%.*]], label [[FOR_BODY]]
423; CHECK:       end:
424; CHECK-NEXT:    ret void
425;
426entry:
427  %0 = trunc i32 %y to i8
428  br label %for.body
429
430for.body:
431  %A.addr.010 = phi i8* [ %A, %entry ], [ %add.ptr, %for.body ]
432  %i.09 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
433  %B.addr.08 = phi i8* [ %B, %entry ], [ %incdec.ptr, %for.body ]
434  %1 = load i8, i8* %A.addr.010, align 1
435  %add.ptr = getelementptr inbounds i8, i8* %A.addr.010, i32 3
436  %conv1 = add i8 %1, %0
437  store i8 %conv1, i8* %B.addr.08, align 1
438  %incdec.ptr = getelementptr inbounds i8, i8* %B.addr.08, i32 1
439  %inc = add nuw nsw i32 %i.09, 1
440  %exitcond = icmp eq i32 %inc, 1000
441  br i1 %exitcond, label %end, label %for.body
442end:
443  ret void
444}
445
446define hidden void @pointer_phi_v4f32_add1(float* noalias nocapture readonly %A, float* noalias nocapture %B, float %y) {
447; CHECK-LABEL: @pointer_phi_v4f32_add1(
448; CHECK-NEXT:  entry:
449; CHECK-NEXT:    [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x float> undef, float [[Y:%.*]], i32 0
450; CHECK-NEXT:    [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x float> [[BROADCAST_SPLATINSERT]], <4 x float> undef, <4 x i32> zeroinitializer
451; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]
452; CHECK:       vector.body:
453; CHECK-NEXT:    [[INDEX:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
454; CHECK-NEXT:    [[NEXT_GEP:%.*]] = getelementptr float, float* [[A:%.*]], i32 [[INDEX]]
455; CHECK-NEXT:    [[NEXT_GEP4:%.*]] = getelementptr float, float* [[B:%.*]], i32 [[INDEX]]
456; CHECK-NEXT:    [[TMP0:%.*]] = bitcast float* [[NEXT_GEP]] to <4 x float>*
457; CHECK-NEXT:    [[WIDE_LOAD:%.*]] = load <4 x float>, <4 x float>* [[TMP0]], align 4
458; CHECK-NEXT:    [[TMP1:%.*]] = fadd fast <4 x float> [[WIDE_LOAD]], [[BROADCAST_SPLAT]]
459; CHECK-NEXT:    [[TMP2:%.*]] = bitcast float* [[NEXT_GEP4]] to <4 x float>*
460; CHECK-NEXT:    store <4 x float> [[TMP1]], <4 x float>* [[TMP2]], align 4
461; CHECK-NEXT:    [[INDEX_NEXT]] = add i32 [[INDEX]], 4
462; CHECK-NEXT:    [[TMP3:%.*]] = icmp eq i32 [[INDEX_NEXT]], 1000
463; CHECK-NEXT:    br i1 [[TMP3]], label [[END:%.*]], label [[VECTOR_BODY]], [[LOOP14:!llvm.loop !.*]]
464; CHECK:       end:
465; CHECK-NEXT:    ret void
466;
467entry:
468  br label %for.body
469for.body:
470  %A.addr.09 = phi float* [ %add.ptr, %for.body ], [ %A, %entry ]
471  %i.08 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
472  %B.addr.07 = phi float* [ %incdec.ptr, %for.body ], [ %B, %entry ]
473  %0 = load float, float* %A.addr.09, align 4
474  %add.ptr = getelementptr inbounds float, float* %A.addr.09, i32 1
475  %add = fadd fast float %0, %y
476  store float %add, float* %B.addr.07, align 4
477  %incdec.ptr = getelementptr inbounds float, float* %B.addr.07, i32 1
478  %inc = add nuw nsw i32 %i.08, 1
479  %exitcond = icmp eq i32 %inc, 1000
480  br i1 %exitcond, label %end, label %for.body
481end:
482  ret void
483}
484
485define hidden void @pointer_phi_v4f32_add2(float* noalias nocapture readonly %A, float* noalias nocapture %B, float %y) {
486; CHECK-LABEL: @pointer_phi_v4f32_add2(
487; CHECK-NEXT:  entry:
488; CHECK-NEXT:    [[IND_END:%.*]] = getelementptr float, float* [[A:%.*]], i32 1992
489; CHECK-NEXT:    [[IND_END3:%.*]] = getelementptr float, float* [[B:%.*]], i32 996
490; CHECK-NEXT:    [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x float> undef, float [[Y:%.*]], i32 0
491; CHECK-NEXT:    [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x float> [[BROADCAST_SPLATINSERT]], <4 x float> undef, <4 x i32> zeroinitializer
492; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]
493; CHECK:       vector.body:
494; CHECK-NEXT:    [[INDEX:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
495; CHECK-NEXT:    [[TMP0:%.*]] = shl i32 [[INDEX]], 1
496; CHECK-NEXT:    [[NEXT_GEP:%.*]] = getelementptr float, float* [[A]], i32 [[TMP0]]
497; CHECK-NEXT:    [[NEXT_GEP4:%.*]] = getelementptr float, float* [[B]], i32 [[INDEX]]
498; CHECK-NEXT:    [[TMP1:%.*]] = bitcast float* [[NEXT_GEP]] to <8 x float>*
499; CHECK-NEXT:    [[WIDE_VEC:%.*]] = load <8 x float>, <8 x float>* [[TMP1]], align 4
500; CHECK-NEXT:    [[STRIDED_VEC:%.*]] = shufflevector <8 x float> [[WIDE_VEC]], <8 x float> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
501; CHECK-NEXT:    [[TMP2:%.*]] = fadd fast <4 x float> [[STRIDED_VEC]], [[BROADCAST_SPLAT]]
502; CHECK-NEXT:    [[TMP3:%.*]] = bitcast float* [[NEXT_GEP4]] to <4 x float>*
503; CHECK-NEXT:    store <4 x float> [[TMP2]], <4 x float>* [[TMP3]], align 4
504; CHECK-NEXT:    [[INDEX_NEXT]] = add i32 [[INDEX]], 4
505; CHECK-NEXT:    [[TMP4:%.*]] = icmp eq i32 [[INDEX_NEXT]], 996
506; CHECK-NEXT:    br i1 [[TMP4]], label [[FOR_BODY:%.*]], label [[VECTOR_BODY]], [[LOOP15:!llvm.loop !.*]]
507; CHECK:       for.body:
508; CHECK-NEXT:    [[A_ADDR_09:%.*]] = phi float* [ [[ADD_PTR:%.*]], [[FOR_BODY]] ], [ [[IND_END]], [[VECTOR_BODY]] ]
509; CHECK-NEXT:    [[I_08:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ 996, [[VECTOR_BODY]] ]
510; CHECK-NEXT:    [[B_ADDR_07:%.*]] = phi float* [ [[INCDEC_PTR:%.*]], [[FOR_BODY]] ], [ [[IND_END3]], [[VECTOR_BODY]] ]
511; CHECK-NEXT:    [[TMP5:%.*]] = load float, float* [[A_ADDR_09]], align 4
512; CHECK-NEXT:    [[ADD_PTR]] = getelementptr inbounds float, float* [[A_ADDR_09]], i32 2
513; CHECK-NEXT:    [[ADD:%.*]] = fadd fast float [[TMP5]], [[Y]]
514; CHECK-NEXT:    store float [[ADD]], float* [[B_ADDR_07]], align 4
515; CHECK-NEXT:    [[INCDEC_PTR]] = getelementptr inbounds float, float* [[B_ADDR_07]], i32 1
516; CHECK-NEXT:    [[INC]] = add nuw nsw i32 [[I_08]], 1
517; CHECK-NEXT:    [[EXITCOND:%.*]] = icmp eq i32 [[INC]], 1000
518; CHECK-NEXT:    br i1 [[EXITCOND]], label [[END:%.*]], label [[FOR_BODY]], [[LOOP16:!llvm.loop !.*]]
519; CHECK:       end:
520; CHECK-NEXT:    ret void
521;
522entry:
523  br label %for.body
524for.body:
525  %A.addr.09 = phi float* [ %add.ptr, %for.body ], [ %A, %entry ]
526  %i.08 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
527  %B.addr.07 = phi float* [ %incdec.ptr, %for.body ], [ %B, %entry ]
528  %0 = load float, float* %A.addr.09, align 4
529  %add.ptr = getelementptr inbounds float, float* %A.addr.09, i32 2
530  %add = fadd fast float %0, %y
531  store float %add, float* %B.addr.07, align 4
532  %incdec.ptr = getelementptr inbounds float, float* %B.addr.07, i32 1
533  %inc = add nuw nsw i32 %i.08, 1
534  %exitcond = icmp eq i32 %inc, 1000
535  br i1 %exitcond, label %end, label %for.body
536end:
537  ret void
538}
539
540define hidden void @pointer_phi_v4f32_add3(float* noalias nocapture readonly %A, float* noalias nocapture %B, float %y) {
541; CHECK-LABEL: @pointer_phi_v4f32_add3(
542; CHECK-NEXT:  entry:
543; CHECK-NEXT:    [[IND_END:%.*]] = getelementptr float, float* [[A:%.*]], i32 2988
544; CHECK-NEXT:    [[IND_END3:%.*]] = getelementptr float, float* [[B:%.*]], i32 996
545; CHECK-NEXT:    [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x float> undef, float [[Y:%.*]], i32 0
546; CHECK-NEXT:    [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x float> [[BROADCAST_SPLATINSERT]], <4 x float> undef, <4 x i32> zeroinitializer
547; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]
548; CHECK:       vector.body:
549; CHECK-NEXT:    [[POINTER_PHI:%.*]] = phi float* [ [[A]], [[ENTRY:%.*]] ], [ [[PTR_IND:%.*]], [[VECTOR_BODY]] ]
550; CHECK-NEXT:    [[INDEX:%.*]] = phi i32 [ 0, [[ENTRY]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
551; CHECK-NEXT:    [[TMP0:%.*]] = getelementptr float, float* [[POINTER_PHI]], <4 x i32> <i32 0, i32 3, i32 6, i32 9>
552; CHECK-NEXT:    [[NEXT_GEP:%.*]] = getelementptr float, float* [[B]], i32 [[INDEX]]
553; CHECK-NEXT:    [[WIDE_MASKED_GATHER:%.*]] = call <4 x float> @llvm.masked.gather.v4f32.v4p0f32(<4 x float*> [[TMP0]], i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x float> undef)
554; CHECK-NEXT:    [[TMP1:%.*]] = fadd fast <4 x float> [[WIDE_MASKED_GATHER]], [[BROADCAST_SPLAT]]
555; CHECK-NEXT:    [[TMP2:%.*]] = bitcast float* [[NEXT_GEP]] to <4 x float>*
556; CHECK-NEXT:    store <4 x float> [[TMP1]], <4 x float>* [[TMP2]], align 4
557; CHECK-NEXT:    [[INDEX_NEXT]] = add i32 [[INDEX]], 4
558; CHECK-NEXT:    [[TMP3:%.*]] = icmp eq i32 [[INDEX_NEXT]], 996
559; CHECK-NEXT:    [[PTR_IND]] = getelementptr float, float* [[POINTER_PHI]], i32 12
560; CHECK-NEXT:    br i1 [[TMP3]], label [[FOR_BODY:%.*]], label [[VECTOR_BODY]], [[LOOP17:!llvm.loop !.*]]
561; CHECK:       for.body:
562; CHECK-NEXT:    [[A_ADDR_09:%.*]] = phi float* [ [[ADD_PTR:%.*]], [[FOR_BODY]] ], [ [[IND_END]], [[VECTOR_BODY]] ]
563; CHECK-NEXT:    [[I_08:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ 996, [[VECTOR_BODY]] ]
564; CHECK-NEXT:    [[B_ADDR_07:%.*]] = phi float* [ [[INCDEC_PTR:%.*]], [[FOR_BODY]] ], [ [[IND_END3]], [[VECTOR_BODY]] ]
565; CHECK-NEXT:    [[TMP4:%.*]] = load float, float* [[A_ADDR_09]], align 4
566; CHECK-NEXT:    [[ADD_PTR]] = getelementptr inbounds float, float* [[A_ADDR_09]], i32 3
567; CHECK-NEXT:    [[ADD:%.*]] = fadd fast float [[TMP4]], [[Y]]
568; CHECK-NEXT:    store float [[ADD]], float* [[B_ADDR_07]], align 4
569; CHECK-NEXT:    [[INCDEC_PTR]] = getelementptr inbounds float, float* [[B_ADDR_07]], i32 1
570; CHECK-NEXT:    [[INC]] = add nuw nsw i32 [[I_08]], 1
571; CHECK-NEXT:    [[EXITCOND:%.*]] = icmp eq i32 [[INC]], 1000
572; CHECK-NEXT:    br i1 [[EXITCOND]], label [[END:%.*]], label [[FOR_BODY]], [[LOOP18:!llvm.loop !.*]]
573; CHECK:       end:
574; CHECK-NEXT:    ret void
575;
576entry:
577  br label %for.body
578for.body:
579  %A.addr.09 = phi float* [ %add.ptr, %for.body ], [ %A, %entry ]
580  %i.08 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
581  %B.addr.07 = phi float* [ %incdec.ptr, %for.body ], [ %B, %entry ]
582  %0 = load float, float* %A.addr.09, align 4
583  %add.ptr = getelementptr inbounds float, float* %A.addr.09, i32 3
584  %add = fadd fast float %0, %y
585  store float %add, float* %B.addr.07, align 4
586  %incdec.ptr = getelementptr inbounds float, float* %B.addr.07, i32 1
587  %inc = add nuw nsw i32 %i.08, 1
588  %exitcond = icmp eq i32 %inc, 1000
589  br i1 %exitcond, label %end, label %for.body
590end:
591  ret void
592}
593
594define hidden void @pointer_phi_v4half_add1(half* noalias nocapture readonly %A, half* noalias nocapture %B, half %y) {
595; CHECK-LABEL: @pointer_phi_v4half_add1(
596; CHECK-NEXT:  entry:
597; CHECK-NEXT:    [[BROADCAST_SPLATINSERT:%.*]] = insertelement <8 x half> undef, half [[Y:%.*]], i32 0
598; CHECK-NEXT:    [[BROADCAST_SPLAT:%.*]] = shufflevector <8 x half> [[BROADCAST_SPLATINSERT]], <8 x half> undef, <8 x i32> zeroinitializer
599; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]
600; CHECK:       vector.body:
601; CHECK-NEXT:    [[INDEX:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
602; CHECK-NEXT:    [[NEXT_GEP:%.*]] = getelementptr half, half* [[A:%.*]], i32 [[INDEX]]
603; CHECK-NEXT:    [[NEXT_GEP4:%.*]] = getelementptr half, half* [[B:%.*]], i32 [[INDEX]]
604; CHECK-NEXT:    [[TMP0:%.*]] = bitcast half* [[NEXT_GEP]] to <8 x half>*
605; CHECK-NEXT:    [[WIDE_LOAD:%.*]] = load <8 x half>, <8 x half>* [[TMP0]], align 4
606; CHECK-NEXT:    [[TMP1:%.*]] = fadd fast <8 x half> [[WIDE_LOAD]], [[BROADCAST_SPLAT]]
607; CHECK-NEXT:    [[TMP2:%.*]] = bitcast half* [[NEXT_GEP4]] to <8 x half>*
608; CHECK-NEXT:    store <8 x half> [[TMP1]], <8 x half>* [[TMP2]], align 4
609; CHECK-NEXT:    [[INDEX_NEXT]] = add i32 [[INDEX]], 8
610; CHECK-NEXT:    [[TMP3:%.*]] = icmp eq i32 [[INDEX_NEXT]], 1000
611; CHECK-NEXT:    br i1 [[TMP3]], label [[END:%.*]], label [[VECTOR_BODY]], [[LOOP19:!llvm.loop !.*]]
612; CHECK:       end:
613; CHECK-NEXT:    ret void
614;
615entry:
616  br label %for.body
617for.body:
618  %A.addr.09 = phi half* [ %add.ptr, %for.body ], [ %A, %entry ]
619  %i.08 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
620  %B.addr.07 = phi half* [ %incdec.ptr, %for.body ], [ %B, %entry ]
621  %0 = load half, half* %A.addr.09, align 4
622  %add.ptr = getelementptr inbounds half, half* %A.addr.09, i32 1
623  %add = fadd fast half %0, %y
624  store half %add, half* %B.addr.07, align 4
625  %incdec.ptr = getelementptr inbounds half, half* %B.addr.07, i32 1
626  %inc = add nuw nsw i32 %i.08, 1
627  %exitcond = icmp eq i32 %inc, 1000
628  br i1 %exitcond, label %end, label %for.body
629end:
630  ret void
631}
632
633define hidden void @pointer_phi_v4half_add2(half* noalias nocapture readonly %A, half* noalias nocapture %B, half %y) {
634; CHECK-LABEL: @pointer_phi_v4half_add2(
635; CHECK-NEXT:  entry:
636; CHECK-NEXT:    [[IND_END:%.*]] = getelementptr half, half* [[A:%.*]], i32 1984
637; CHECK-NEXT:    [[IND_END3:%.*]] = getelementptr half, half* [[B:%.*]], i32 992
638; CHECK-NEXT:    [[BROADCAST_SPLATINSERT:%.*]] = insertelement <8 x half> undef, half [[Y:%.*]], i32 0
639; CHECK-NEXT:    [[BROADCAST_SPLAT:%.*]] = shufflevector <8 x half> [[BROADCAST_SPLATINSERT]], <8 x half> undef, <8 x i32> zeroinitializer
640; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]
641; CHECK:       vector.body:
642; CHECK-NEXT:    [[INDEX:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
643; CHECK-NEXT:    [[TMP0:%.*]] = shl i32 [[INDEX]], 1
644; CHECK-NEXT:    [[NEXT_GEP:%.*]] = getelementptr half, half* [[A]], i32 [[TMP0]]
645; CHECK-NEXT:    [[NEXT_GEP4:%.*]] = getelementptr half, half* [[B]], i32 [[INDEX]]
646; CHECK-NEXT:    [[TMP1:%.*]] = bitcast half* [[NEXT_GEP]] to <16 x half>*
647; CHECK-NEXT:    [[WIDE_VEC:%.*]] = load <16 x half>, <16 x half>* [[TMP1]], align 4
648; CHECK-NEXT:    [[STRIDED_VEC:%.*]] = shufflevector <16 x half> [[WIDE_VEC]], <16 x half> undef, <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14>
649; CHECK-NEXT:    [[TMP2:%.*]] = fadd fast <8 x half> [[STRIDED_VEC]], [[BROADCAST_SPLAT]]
650; CHECK-NEXT:    [[TMP3:%.*]] = bitcast half* [[NEXT_GEP4]] to <8 x half>*
651; CHECK-NEXT:    store <8 x half> [[TMP2]], <8 x half>* [[TMP3]], align 4
652; CHECK-NEXT:    [[INDEX_NEXT]] = add i32 [[INDEX]], 8
653; CHECK-NEXT:    [[TMP4:%.*]] = icmp eq i32 [[INDEX_NEXT]], 992
654; CHECK-NEXT:    br i1 [[TMP4]], label [[FOR_BODY:%.*]], label [[VECTOR_BODY]], [[LOOP20:!llvm.loop !.*]]
655; CHECK:       for.body:
656; CHECK-NEXT:    [[A_ADDR_09:%.*]] = phi half* [ [[ADD_PTR:%.*]], [[FOR_BODY]] ], [ [[IND_END]], [[VECTOR_BODY]] ]
657; CHECK-NEXT:    [[I_08:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ 992, [[VECTOR_BODY]] ]
658; CHECK-NEXT:    [[B_ADDR_07:%.*]] = phi half* [ [[INCDEC_PTR:%.*]], [[FOR_BODY]] ], [ [[IND_END3]], [[VECTOR_BODY]] ]
659; CHECK-NEXT:    [[TMP5:%.*]] = load half, half* [[A_ADDR_09]], align 4
660; CHECK-NEXT:    [[ADD_PTR]] = getelementptr inbounds half, half* [[A_ADDR_09]], i32 2
661; CHECK-NEXT:    [[ADD:%.*]] = fadd fast half [[TMP5]], [[Y]]
662; CHECK-NEXT:    store half [[ADD]], half* [[B_ADDR_07]], align 4
663; CHECK-NEXT:    [[INCDEC_PTR]] = getelementptr inbounds half, half* [[B_ADDR_07]], i32 1
664; CHECK-NEXT:    [[INC]] = add nuw nsw i32 [[I_08]], 1
665; CHECK-NEXT:    [[EXITCOND:%.*]] = icmp eq i32 [[INC]], 1000
666; CHECK-NEXT:    br i1 [[EXITCOND]], label [[END:%.*]], label [[FOR_BODY]], [[LOOP21:!llvm.loop !.*]]
667; CHECK:       end:
668; CHECK-NEXT:    ret void
669;
670entry:
671  br label %for.body
672for.body:
673  %A.addr.09 = phi half* [ %add.ptr, %for.body ], [ %A, %entry ]
674  %i.08 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
675  %B.addr.07 = phi half* [ %incdec.ptr, %for.body ], [ %B, %entry ]
676  %0 = load half, half* %A.addr.09, align 4
677  %add.ptr = getelementptr inbounds half, half* %A.addr.09, i32 2
678  %add = fadd fast half %0, %y
679  store half %add, half* %B.addr.07, align 4
680  %incdec.ptr = getelementptr inbounds half, half* %B.addr.07, i32 1
681  %inc = add nuw nsw i32 %i.08, 1
682  %exitcond = icmp eq i32 %inc, 1000
683  br i1 %exitcond, label %end, label %for.body
684end:
685  ret void
686}
687
688define hidden void @pointer_phi_v4half_add3(half* noalias nocapture readonly %A, half* noalias nocapture %B, half %y) {
689; CHECK-LABEL: @pointer_phi_v4half_add3(
690; CHECK-NEXT:  entry:
691; CHECK-NEXT:    br label [[FOR_BODY:%.*]]
692; CHECK:       for.body:
693; CHECK-NEXT:    [[A_ADDR_09:%.*]] = phi half* [ [[ADD_PTR:%.*]], [[FOR_BODY]] ], [ [[A:%.*]], [[ENTRY:%.*]] ]
694; CHECK-NEXT:    [[I_08:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY]] ]
695; CHECK-NEXT:    [[B_ADDR_07:%.*]] = phi half* [ [[INCDEC_PTR:%.*]], [[FOR_BODY]] ], [ [[B:%.*]], [[ENTRY]] ]
696; CHECK-NEXT:    [[TMP0:%.*]] = load half, half* [[A_ADDR_09]], align 4
697; CHECK-NEXT:    [[ADD_PTR]] = getelementptr inbounds half, half* [[A_ADDR_09]], i32 3
698; CHECK-NEXT:    [[ADD:%.*]] = fadd fast half [[TMP0]], [[Y:%.*]]
699; CHECK-NEXT:    store half [[ADD]], half* [[B_ADDR_07]], align 4
700; CHECK-NEXT:    [[INCDEC_PTR]] = getelementptr inbounds half, half* [[B_ADDR_07]], i32 1
701; CHECK-NEXT:    [[INC]] = add nuw nsw i32 [[I_08]], 1
702; CHECK-NEXT:    [[EXITCOND:%.*]] = icmp eq i32 [[INC]], 1000
703; CHECK-NEXT:    br i1 [[EXITCOND]], label [[END:%.*]], label [[FOR_BODY]]
704; CHECK:       end:
705; CHECK-NEXT:    ret void
706;
707entry:
708  br label %for.body
709for.body:
710  %A.addr.09 = phi half* [ %add.ptr, %for.body ], [ %A, %entry ]
711  %i.08 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
712  %B.addr.07 = phi half* [ %incdec.ptr, %for.body ], [ %B, %entry ]
713  %0 = load half, half* %A.addr.09, align 4
714  %add.ptr = getelementptr inbounds half, half* %A.addr.09, i32 3
715  %add = fadd fast half %0, %y
716  store half %add, half* %B.addr.07, align 4
717  %incdec.ptr = getelementptr inbounds half, half* %B.addr.07, i32 1
718  %inc = add nuw nsw i32 %i.08, 1
719  %exitcond = icmp eq i32 %inc, 1000
720  br i1 %exitcond, label %end, label %for.body
721end:
722  ret void
723}
724
725!0 = distinct !{!0, !1}
726!1 = !{!"llvm.loop.interleave.count", i32 2}
727
728define hidden void @pointer_phi_v4i32_uf2(i32* noalias nocapture readonly %A, i32* noalias nocapture %B, i32 %n, i32 %y) {
729; CHECK-LABEL: @pointer_phi_v4i32_uf2(
730; CHECK-NEXT:  entry:
731; CHECK-NEXT:    [[IND_END:%.*]] = getelementptr i32, i32* [[A:%.*]], i32 59952
732; CHECK-NEXT:    [[IND_END3:%.*]] = getelementptr i32, i32* [[B:%.*]], i32 9992
733; CHECK-NEXT:    [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x i32> undef, i32 [[Y:%.*]], i32 0
734; CHECK-NEXT:    [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT]], <4 x i32> undef, <4 x i32> zeroinitializer
735; CHECK-NEXT:    [[BROADCAST_SPLATINSERT6:%.*]] = insertelement <4 x i32> undef, i32 [[Y]], i32 0
736; CHECK-NEXT:    [[BROADCAST_SPLAT7:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT6]], <4 x i32> undef, <4 x i32> zeroinitializer
737; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]
738; CHECK:       vector.body:
739; CHECK-NEXT:    [[POINTER_PHI:%.*]] = phi i32* [ [[A]], [[ENTRY:%.*]] ], [ [[PTR_IND:%.*]], [[VECTOR_BODY]] ]
740; CHECK-NEXT:    [[INDEX:%.*]] = phi i32 [ 0, [[ENTRY]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
741; CHECK-NEXT:    [[TMP0:%.*]] = getelementptr i32, i32* [[POINTER_PHI]], <4 x i32> <i32 0, i32 6, i32 12, i32 18>
742; CHECK-NEXT:    [[TMP1:%.*]] = getelementptr i32, i32* [[POINTER_PHI]], <4 x i32> <i32 24, i32 30, i32 36, i32 42>
743; CHECK-NEXT:    [[NEXT_GEP:%.*]] = getelementptr i32, i32* [[B]], i32 [[INDEX]]
744; CHECK-NEXT:    [[WIDE_MASKED_GATHER:%.*]] = call <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*> [[TMP0]], i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i32> undef)
745; CHECK-NEXT:    [[WIDE_MASKED_GATHER5:%.*]] = call <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*> [[TMP1]], i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i32> undef)
746; CHECK-NEXT:    [[TMP2:%.*]] = add nsw <4 x i32> [[WIDE_MASKED_GATHER]], [[BROADCAST_SPLAT]]
747; CHECK-NEXT:    [[TMP3:%.*]] = add nsw <4 x i32> [[WIDE_MASKED_GATHER5]], [[BROADCAST_SPLAT7]]
748; CHECK-NEXT:    [[TMP4:%.*]] = bitcast i32* [[NEXT_GEP]] to <4 x i32>*
749; CHECK-NEXT:    store <4 x i32> [[TMP2]], <4 x i32>* [[TMP4]], align 4
750; CHECK-NEXT:    [[TMP5:%.*]] = getelementptr i32, i32* [[NEXT_GEP]], i32 4
751; CHECK-NEXT:    [[TMP6:%.*]] = bitcast i32* [[TMP5]] to <4 x i32>*
752; CHECK-NEXT:    store <4 x i32> [[TMP3]], <4 x i32>* [[TMP6]], align 4
753; CHECK-NEXT:    [[INDEX_NEXT]] = add i32 [[INDEX]], 8
754; CHECK-NEXT:    [[TMP7:%.*]] = icmp eq i32 [[INDEX_NEXT]], 9992
755; CHECK-NEXT:    [[PTR_IND]] = getelementptr i32, i32* [[POINTER_PHI]], i32 48
756; CHECK-NEXT:    br i1 [[TMP7]], label [[FOR_BODY:%.*]], label [[VECTOR_BODY]], [[LOOP22:!llvm.loop !.*]]
757; CHECK:       for.cond.cleanup:
758; CHECK-NEXT:    ret void
759; CHECK:       for.body:
760; CHECK-NEXT:    [[A_ADDR_08:%.*]] = phi i32* [ [[ADD_PTR:%.*]], [[FOR_BODY]] ], [ [[IND_END]], [[VECTOR_BODY]] ]
761; CHECK-NEXT:    [[I_07:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ 9992, [[VECTOR_BODY]] ]
762; CHECK-NEXT:    [[B_ADDR_06:%.*]] = phi i32* [ [[INCDEC_PTR:%.*]], [[FOR_BODY]] ], [ [[IND_END3]], [[VECTOR_BODY]] ]
763; CHECK-NEXT:    [[TMP8:%.*]] = load i32, i32* [[A_ADDR_08]], align 4
764; CHECK-NEXT:    [[ADD_PTR]] = getelementptr inbounds i32, i32* [[A_ADDR_08]], i32 6
765; CHECK-NEXT:    [[ADD:%.*]] = add nsw i32 [[TMP8]], [[Y]]
766; CHECK-NEXT:    store i32 [[ADD]], i32* [[B_ADDR_06]], align 4
767; CHECK-NEXT:    [[INCDEC_PTR]] = getelementptr inbounds i32, i32* [[B_ADDR_06]], i32 1
768; CHECK-NEXT:    [[INC]] = add nuw nsw i32 [[I_07]], 1
769; CHECK-NEXT:    [[EXITCOND:%.*]] = icmp eq i32 [[INC]], 10000
770; CHECK-NEXT:    br i1 [[EXITCOND]], label [[FOR_COND_CLEANUP:%.*]], label [[FOR_BODY]], [[LOOP23:!llvm.loop !.*]]
771;
772
773entry:
774  br label %for.body
775
776for.cond.cleanup:
777  ret void
778
779for.body:
780  %A.addr.08 = phi i32* [ %A, %entry ], [ %add.ptr, %for.body ]
781  %i.07 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
782  %B.addr.06 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
783  %0 = load i32, i32* %A.addr.08, align 4
784  %add.ptr = getelementptr inbounds i32, i32* %A.addr.08, i32 6
785  %add = add nsw i32 %0, %y
786  store i32 %add, i32* %B.addr.06, align 4
787  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.06, i32 1
788  %inc = add nuw nsw i32 %i.07, 1
789  %exitcond = icmp eq i32 %inc, 10000
790  br i1 %exitcond, label %for.cond.cleanup, label %for.body, !llvm.loop !0
791}
792
793!2 = distinct !{!2, !3}
794!3 = !{!"llvm.loop.interleave.count", i32 4}
795
796define hidden void @pointer_phi_v4i32_uf4(i32* noalias nocapture readonly %A, i32* noalias nocapture %B, i32 %n, i32 %y) {
797; CHECK-LABEL: @pointer_phi_v4i32_uf4(
798; CHECK-NEXT:  entry:
799; CHECK-NEXT:    [[IND_END:%.*]] = getelementptr i32, i32* [[A:%.*]], i32 59904
800; CHECK-NEXT:    [[IND_END3:%.*]] = getelementptr i32, i32* [[B:%.*]], i32 9984
801; CHECK-NEXT:    [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x i32> undef, i32 [[Y:%.*]], i32 0
802; CHECK-NEXT:    [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT]], <4 x i32> undef, <4 x i32> zeroinitializer
803; CHECK-NEXT:    [[BROADCAST_SPLATINSERT10:%.*]] = insertelement <4 x i32> undef, i32 [[Y]], i32 0
804; CHECK-NEXT:    [[BROADCAST_SPLAT11:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT10]], <4 x i32> undef, <4 x i32> zeroinitializer
805; CHECK-NEXT:    [[BROADCAST_SPLATINSERT12:%.*]] = insertelement <4 x i32> undef, i32 [[Y]], i32 0
806; CHECK-NEXT:    [[BROADCAST_SPLAT13:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT12]], <4 x i32> undef, <4 x i32> zeroinitializer
807; CHECK-NEXT:    [[BROADCAST_SPLATINSERT14:%.*]] = insertelement <4 x i32> undef, i32 [[Y]], i32 0
808; CHECK-NEXT:    [[BROADCAST_SPLAT15:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT14]], <4 x i32> undef, <4 x i32> zeroinitializer
809; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]
810; CHECK:       vector.body:
811; CHECK-NEXT:    [[POINTER_PHI:%.*]] = phi i32* [ [[A]], [[ENTRY:%.*]] ], [ [[PTR_IND:%.*]], [[VECTOR_BODY]] ]
812; CHECK-NEXT:    [[INDEX:%.*]] = phi i32 [ 0, [[ENTRY]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
813; CHECK-NEXT:    [[TMP0:%.*]] = getelementptr i32, i32* [[POINTER_PHI]], <4 x i32> <i32 0, i32 6, i32 12, i32 18>
814; CHECK-NEXT:    [[TMP1:%.*]] = getelementptr i32, i32* [[POINTER_PHI]], <4 x i32> <i32 24, i32 30, i32 36, i32 42>
815; CHECK-NEXT:    [[TMP2:%.*]] = getelementptr i32, i32* [[POINTER_PHI]], <4 x i32> <i32 48, i32 54, i32 60, i32 66>
816; CHECK-NEXT:    [[TMP3:%.*]] = getelementptr i32, i32* [[POINTER_PHI]], <4 x i32> <i32 72, i32 78, i32 84, i32 90>
817; CHECK-NEXT:    [[NEXT_GEP:%.*]] = getelementptr i32, i32* [[B]], i32 [[INDEX]]
818; CHECK-NEXT:    [[WIDE_MASKED_GATHER:%.*]] = call <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*> [[TMP0]], i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i32> undef)
819; CHECK-NEXT:    [[WIDE_MASKED_GATHER7:%.*]] = call <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*> [[TMP1]], i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i32> undef)
820; CHECK-NEXT:    [[WIDE_MASKED_GATHER8:%.*]] = call <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*> [[TMP2]], i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i32> undef)
821; CHECK-NEXT:    [[WIDE_MASKED_GATHER9:%.*]] = call <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*> [[TMP3]], i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i32> undef)
822; CHECK-NEXT:    [[TMP4:%.*]] = add nsw <4 x i32> [[WIDE_MASKED_GATHER]], [[BROADCAST_SPLAT]]
823; CHECK-NEXT:    [[TMP5:%.*]] = add nsw <4 x i32> [[WIDE_MASKED_GATHER7]], [[BROADCAST_SPLAT11]]
824; CHECK-NEXT:    [[TMP6:%.*]] = add nsw <4 x i32> [[WIDE_MASKED_GATHER8]], [[BROADCAST_SPLAT13]]
825; CHECK-NEXT:    [[TMP7:%.*]] = add nsw <4 x i32> [[WIDE_MASKED_GATHER9]], [[BROADCAST_SPLAT15]]
826; CHECK-NEXT:    [[TMP8:%.*]] = bitcast i32* [[NEXT_GEP]] to <4 x i32>*
827; CHECK-NEXT:    store <4 x i32> [[TMP4]], <4 x i32>* [[TMP8]], align 4
828; CHECK-NEXT:    [[TMP9:%.*]] = getelementptr i32, i32* [[NEXT_GEP]], i32 4
829; CHECK-NEXT:    [[TMP10:%.*]] = bitcast i32* [[TMP9]] to <4 x i32>*
830; CHECK-NEXT:    store <4 x i32> [[TMP5]], <4 x i32>* [[TMP10]], align 4
831; CHECK-NEXT:    [[TMP11:%.*]] = getelementptr i32, i32* [[NEXT_GEP]], i32 8
832; CHECK-NEXT:    [[TMP12:%.*]] = bitcast i32* [[TMP11]] to <4 x i32>*
833; CHECK-NEXT:    store <4 x i32> [[TMP6]], <4 x i32>* [[TMP12]], align 4
834; CHECK-NEXT:    [[TMP13:%.*]] = getelementptr i32, i32* [[NEXT_GEP]], i32 12
835; CHECK-NEXT:    [[TMP14:%.*]] = bitcast i32* [[TMP13]] to <4 x i32>*
836; CHECK-NEXT:    store <4 x i32> [[TMP7]], <4 x i32>* [[TMP14]], align 4
837; CHECK-NEXT:    [[INDEX_NEXT]] = add i32 [[INDEX]], 16
838; CHECK-NEXT:    [[TMP15:%.*]] = icmp eq i32 [[INDEX_NEXT]], 9984
839; CHECK-NEXT:    [[PTR_IND]] = getelementptr i32, i32* [[POINTER_PHI]], i32 96
840; CHECK-NEXT:    br i1 [[TMP15]], label [[FOR_BODY:%.*]], label [[VECTOR_BODY]], [[LOOP24:!llvm.loop !.*]]
841; CHECK:       for.cond.cleanup:
842; CHECK-NEXT:    ret void
843; CHECK:       for.body:
844; CHECK-NEXT:    [[A_ADDR_08:%.*]] = phi i32* [ [[ADD_PTR:%.*]], [[FOR_BODY]] ], [ [[IND_END]], [[VECTOR_BODY]] ]
845; CHECK-NEXT:    [[I_07:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ 9984, [[VECTOR_BODY]] ]
846; CHECK-NEXT:    [[B_ADDR_06:%.*]] = phi i32* [ [[INCDEC_PTR:%.*]], [[FOR_BODY]] ], [ [[IND_END3]], [[VECTOR_BODY]] ]
847; CHECK-NEXT:    [[TMP16:%.*]] = load i32, i32* [[A_ADDR_08]], align 4
848; CHECK-NEXT:    [[ADD_PTR]] = getelementptr inbounds i32, i32* [[A_ADDR_08]], i32 6
849; CHECK-NEXT:    [[ADD:%.*]] = add nsw i32 [[TMP16]], [[Y]]
850; CHECK-NEXT:    store i32 [[ADD]], i32* [[B_ADDR_06]], align 4
851; CHECK-NEXT:    [[INCDEC_PTR]] = getelementptr inbounds i32, i32* [[B_ADDR_06]], i32 1
852; CHECK-NEXT:    [[INC]] = add nuw nsw i32 [[I_07]], 1
853; CHECK-NEXT:    [[EXITCOND:%.*]] = icmp eq i32 [[INC]], 10000
854; CHECK-NEXT:    br i1 [[EXITCOND]], label [[FOR_COND_CLEANUP:%.*]], label [[FOR_BODY]], [[LOOP25:!llvm.loop !.*]]
855;
856entry:
857  br label %for.body
858
859for.cond.cleanup:
860  ret void
861
862for.body:
863  %A.addr.08 = phi i32* [ %A, %entry ], [ %add.ptr, %for.body ]
864  %i.07 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
865  %B.addr.06 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
866  %0 = load i32, i32* %A.addr.08, align 4
867  %add.ptr = getelementptr inbounds i32, i32* %A.addr.08, i32 6
868  %add = add nsw i32 %0, %y
869  store i32 %add, i32* %B.addr.06, align 4
870  %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.06, i32 1
871  %inc = add nuw nsw i32 %i.07, 1
872  %exitcond = icmp eq i32 %inc, 10000
873  br i1 %exitcond, label %for.cond.cleanup, label %for.body, !llvm.loop !2
874}
875
876define hidden void @mult_ptr_iv(i8* noalias nocapture readonly %x, i8* noalias nocapture %z) {
877; CHECK-LABEL: @mult_ptr_iv(
878; CHECK-NEXT:  entry:
879; CHECK-NEXT:    [[SCEVGEP:%.*]] = getelementptr i8, i8* [[Z:%.*]], i32 3000
880; CHECK-NEXT:    [[SCEVGEP1:%.*]] = getelementptr i8, i8* [[X:%.*]], i32 3000
881; CHECK-NEXT:    [[BOUND0:%.*]] = icmp ugt i8* [[SCEVGEP1]], [[Z]]
882; CHECK-NEXT:    [[BOUND1:%.*]] = icmp ugt i8* [[SCEVGEP]], [[X]]
883; CHECK-NEXT:    [[FOUND_CONFLICT:%.*]] = and i1 [[BOUND0]], [[BOUND1]]
884; CHECK-NEXT:    br i1 [[FOUND_CONFLICT]], label [[FOR_BODY:%.*]], label [[VECTOR_PH:%.*]]
885; CHECK:       vector.ph:
886; CHECK-NEXT:    [[IND_END:%.*]] = getelementptr i8, i8* [[X]], i32 3000
887; CHECK-NEXT:    [[IND_END3:%.*]] = getelementptr i8, i8* [[Z]], i32 3000
888; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]
889; CHECK:       vector.body:
890; CHECK-NEXT:    [[POINTER_PHI:%.*]] = phi i8* [ [[X]], [[VECTOR_PH]] ], [ [[PTR_IND:%.*]], [[VECTOR_BODY]] ]
891; CHECK-NEXT:    [[POINTER_PHI5:%.*]] = phi i8* [ [[Z]], [[VECTOR_PH]] ], [ [[PTR_IND6:%.*]], [[VECTOR_BODY]] ]
892; CHECK-NEXT:    [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
893; CHECK-NEXT:    [[TMP0:%.*]] = getelementptr i8, i8* [[POINTER_PHI]], <4 x i32> <i32 0, i32 3, i32 6, i32 9>
894; CHECK-NEXT:    [[TMP1:%.*]] = getelementptr i8, i8* [[POINTER_PHI5]], <4 x i32> <i32 0, i32 3, i32 6, i32 9>
895; CHECK-NEXT:    [[TMP2:%.*]] = getelementptr inbounds i8, <4 x i8*> [[TMP0]], i32 1
896; CHECK-NEXT:    [[WIDE_MASKED_GATHER:%.*]] = call <4 x i8> @llvm.masked.gather.v4i8.v4p0i8(<4 x i8*> [[TMP0]], i32 1, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i8> undef), !alias.scope !26
897; CHECK-NEXT:    [[TMP3:%.*]] = getelementptr inbounds i8, <4 x i8*> [[TMP0]], i32 2
898; CHECK-NEXT:    [[WIDE_MASKED_GATHER7:%.*]] = call <4 x i8> @llvm.masked.gather.v4i8.v4p0i8(<4 x i8*> [[TMP2]], i32 1, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i8> undef), !alias.scope !26
899; CHECK-NEXT:    [[WIDE_MASKED_GATHER8:%.*]] = call <4 x i8> @llvm.masked.gather.v4i8.v4p0i8(<4 x i8*> [[TMP3]], i32 1, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i8> undef), !alias.scope !26
900; CHECK-NEXT:    [[TMP4:%.*]] = mul <4 x i8> [[WIDE_MASKED_GATHER]], <i8 10, i8 10, i8 10, i8 10>
901; CHECK-NEXT:    [[TMP5:%.*]] = mul <4 x i8> [[WIDE_MASKED_GATHER]], [[WIDE_MASKED_GATHER7]]
902; CHECK-NEXT:    [[TMP6:%.*]] = mul <4 x i8> [[WIDE_MASKED_GATHER]], [[WIDE_MASKED_GATHER8]]
903; CHECK-NEXT:    [[TMP7:%.*]] = getelementptr inbounds i8, <4 x i8*> [[TMP1]], i32 1
904; CHECK-NEXT:    call void @llvm.masked.scatter.v4i8.v4p0i8(<4 x i8> [[TMP4]], <4 x i8*> [[TMP1]], i32 1, <4 x i1> <i1 true, i1 true, i1 true, i1 true>), !alias.scope !29, !noalias !26
905; CHECK-NEXT:    [[TMP8:%.*]] = getelementptr inbounds i8, <4 x i8*> [[TMP1]], i32 2
906; CHECK-NEXT:    call void @llvm.masked.scatter.v4i8.v4p0i8(<4 x i8> [[TMP5]], <4 x i8*> [[TMP7]], i32 1, <4 x i1> <i1 true, i1 true, i1 true, i1 true>), !alias.scope !29, !noalias !26
907; CHECK-NEXT:    call void @llvm.masked.scatter.v4i8.v4p0i8(<4 x i8> [[TMP6]], <4 x i8*> [[TMP8]], i32 1, <4 x i1> <i1 true, i1 true, i1 true, i1 true>), !alias.scope !29, !noalias !26
908; CHECK-NEXT:    [[INDEX_NEXT]] = add i32 [[INDEX]], 4
909; CHECK-NEXT:    [[TMP9:%.*]] = icmp eq i32 [[INDEX_NEXT]], 1000
910; CHECK-NEXT:    [[PTR_IND]] = getelementptr i8, i8* [[POINTER_PHI]], i32 12
911; CHECK-NEXT:    [[PTR_IND6]] = getelementptr i8, i8* [[POINTER_PHI5]], i32 12
912; CHECK-NEXT:    br i1 [[TMP9]], label [[END:%.*]], label [[VECTOR_BODY]], [[LOOP31:!llvm.loop !.*]]
913; CHECK:       for.body:
914; CHECK-NEXT:    [[X_ADDR_050:%.*]] = phi i8* [ [[INCDEC_PTR2:%.*]], [[FOR_BODY]] ], [ [[X]], [[ENTRY:%.*]] ]
915; CHECK-NEXT:    [[Z_ADDR_049:%.*]] = phi i8* [ [[INCDEC_PTR34:%.*]], [[FOR_BODY]] ], [ [[Z]], [[ENTRY]] ]
916; CHECK-NEXT:    [[I_048:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY]] ]
917; CHECK-NEXT:    [[INCDEC_PTR:%.*]] = getelementptr inbounds i8, i8* [[X_ADDR_050]], i32 1
918; CHECK-NEXT:    [[TMP10:%.*]] = load i8, i8* [[X_ADDR_050]], align 1
919; CHECK-NEXT:    [[INCDEC_PTR1:%.*]] = getelementptr inbounds i8, i8* [[X_ADDR_050]], i32 2
920; CHECK-NEXT:    [[TMP11:%.*]] = load i8, i8* [[INCDEC_PTR]], align 1
921; CHECK-NEXT:    [[INCDEC_PTR2]] = getelementptr inbounds i8, i8* [[X_ADDR_050]], i32 3
922; CHECK-NEXT:    [[TMP12:%.*]] = load i8, i8* [[INCDEC_PTR1]], align 1
923; CHECK-NEXT:    [[MUL:%.*]] = mul i8 [[TMP10]], 10
924; CHECK-NEXT:    [[MUL1:%.*]] = mul i8 [[TMP10]], [[TMP11]]
925; CHECK-NEXT:    [[MUL2:%.*]] = mul i8 [[TMP10]], [[TMP12]]
926; CHECK-NEXT:    [[INCDEC_PTR32:%.*]] = getelementptr inbounds i8, i8* [[Z_ADDR_049]], i32 1
927; CHECK-NEXT:    store i8 [[MUL]], i8* [[Z_ADDR_049]], align 1
928; CHECK-NEXT:    [[INCDEC_PTR33:%.*]] = getelementptr inbounds i8, i8* [[Z_ADDR_049]], i32 2
929; CHECK-NEXT:    store i8 [[MUL1]], i8* [[INCDEC_PTR32]], align 1
930; CHECK-NEXT:    [[INCDEC_PTR34]] = getelementptr inbounds i8, i8* [[Z_ADDR_049]], i32 3
931; CHECK-NEXT:    store i8 [[MUL2]], i8* [[INCDEC_PTR33]], align 1
932; CHECK-NEXT:    [[INC]] = add nuw i32 [[I_048]], 1
933; CHECK-NEXT:    [[EXITCOND:%.*]] = icmp eq i32 [[INC]], 1000
934; CHECK-NEXT:    br i1 [[EXITCOND]], label [[END]], label [[FOR_BODY]], [[LOOP32:!llvm.loop !.*]]
935; CHECK:       end:
936; CHECK-NEXT:    ret void
937;
938entry:
939  br label %for.body
940
941for.body:
942  %x.addr.050 = phi i8* [ %incdec.ptr2, %for.body ], [ %x, %entry ]
943  %z.addr.049 = phi i8* [ %incdec.ptr34, %for.body ], [ %z, %entry ]
944  %i.048 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
945  %incdec.ptr = getelementptr inbounds i8, i8* %x.addr.050, i32 1
946  %0 = load i8, i8* %x.addr.050, align 1
947  %incdec.ptr1 = getelementptr inbounds i8, i8* %x.addr.050, i32 2
948  %1 = load i8, i8* %incdec.ptr, align 1
949  %incdec.ptr2 = getelementptr inbounds i8, i8* %x.addr.050, i32 3
950  %2 = load i8, i8* %incdec.ptr1, align 1
951  %conv = zext i8 %0 to i32
952  %mul = mul nuw nsw i32 %conv, 10
953  %conv1 = zext i8 %1 to i32
954  %conv2 = zext i8 %2 to i32
955  %mul1 = mul nuw nsw i32 %conv, %conv1
956  %mul2 = mul nuw nsw i32 %conv, %conv2
957  %conv3 = trunc i32 %mul to i8
958  %conv4 = trunc i32 %mul1 to i8
959  %conv5 = trunc i32 %mul2 to i8
960  %incdec.ptr32 = getelementptr inbounds i8, i8* %z.addr.049, i32 1
961  store i8 %conv3, i8* %z.addr.049, align 1
962  %incdec.ptr33 = getelementptr inbounds i8, i8* %z.addr.049, i32 2
963  store i8 %conv4, i8* %incdec.ptr32, align 1
964  %incdec.ptr34 = getelementptr inbounds i8, i8* %z.addr.049, i32 3
965  store i8 %conv5, i8* %incdec.ptr33, align 1
966  %inc = add nuw i32 %i.048, 1
967  %exitcond = icmp eq i32 %inc, 1000
968  br i1 %exitcond, label %end, label %for.body
969
970end:
971  ret void
972}
973