Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / parallel_for_scan_codegen.cpp
blob161534814a793deb9368a41e33f2409a4b413a0e
1 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
5 // RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
6 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple x86_64-unknown-unknown -emit-pch -o %t %s
7 // RUN: %clang_cc1 -fopenmp-simd -x c++ -triple x86_64-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
8 // SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
9 // expected-no-diagnostics
10 #ifndef HEADER
11 #define HEADER
13 void foo(int n);
14 void bar();
16 // CHECK: define{{.*}} void @{{.*}}baz{{.*}}(i32 noundef %n)
17 void baz(int n) {
18 static float a[10];
19 static double b;
21 // CHECK: call ptr @llvm.stacksave.p0()
22 // CHECK: [[A_BUF_SIZE:%.+]] = mul nuw i64 10, [[NUM_ELEMS:%[^,]+]]
24 // float a_buffer[10][n];
25 // CHECK: [[A_BUF:%.+]] = alloca float, i64 [[A_BUF_SIZE]],
26 // double b_buffer[10];
27 // CHECK: [[B_BUF:%.+]] = alloca double, i64 10,
29 // CHECK: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(
30 // CHECK: [[LAST:%.+]] = mul nsw i64 9, %
31 // CHECK: [[LAST_REF:%.+]] = getelementptr inbounds float, ptr [[A_BUF]], i64 [[LAST]]
32 // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 16 @_ZZ3baziE1a, ptr align 4 [[LAST_REF]], i64 %{{.+}}, i1 false)
33 // CHECK: [[LAST_REF_B:%.+]] = getelementptr inbounds double, ptr [[B_BUF]], i64 9
34 // CHECK: [[LAST_VAL:%.+]] = load double, ptr [[LAST_REF_B]],
35 // CHECK: store double [[LAST_VAL]], ptr @_ZZ3baziE1b,
37 // CHECK: [[A_BUF_SIZE:%.+]] = mul nuw i64 10, [[NUM_ELEMS:%[^,]+]]
39 // float a_buffer[10][n];
40 // CHECK: [[A_BUF:%.+]] = alloca float, i64 [[A_BUF_SIZE]],
42 // double b_buffer[10];
43 // CHECK: [[B_BUF:%.+]] = alloca double, i64 10,
44 // CHECK: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(
45 // CHECK: call void @llvm.stackrestore.p0(ptr
47 #pragma omp parallel for reduction(inscan, +:a[:n], b)
48 for (int i = 0; i < 10; ++i) {
49 // CHECK: call void @__kmpc_for_static_init_4(
50 // CHECK: call ptr @llvm.stacksave.p0()
51 // CHECK: store float 0.000000e+00, ptr %
52 // CHECK: store double 0.000000e+00, ptr [[B_PRIV_ADDR:%.+]],
53 // CHECK: br label %[[DISPATCH:[^,]+]]
54 // CHECK: [[INPUT_PHASE:.+]]:
55 // CHECK: call void @{{.+}}foo{{.+}}(
57 // a_buffer[i][0..n] = a_priv[[0..n];
58 // CHECK: [[BASE_IDX_I:%.+]] = load i32, ptr [[IV_ADDR:%.+]],
59 // CHECK: [[BASE_IDX:%.+]] = zext i32 [[BASE_IDX_I]] to i64
60 // CHECK: [[IDX:%.+]] = mul nsw i64 [[BASE_IDX]], [[NUM_ELEMS:%.+]]
61 // CHECK: [[A_BUF_IDX:%.+]] = getelementptr inbounds float, ptr [[A_BUF:%.+]], i64 [[IDX]]
62 // CHECK: [[A_PRIV:%.+]] = getelementptr inbounds [10 x float], ptr [[A_PRIV_ADDR:%.+]], i64 0, i64 0
63 // CHECK: [[BYTES:%.+]] = mul nuw i64 [[NUM_ELEMS:%.+]], 4
64 // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}}[[A_BUF_IDX]], ptr {{.*}}[[A_PRIV]], i64 [[BYTES]], i1 false)
66 // b_buffer[i] = b_priv;
67 // CHECK: [[B_BUF_IDX:%.+]] = getelementptr inbounds double, ptr [[B_BUF:%.+]], i64 [[BASE_IDX]]
68 // CHECK: [[B_PRIV:%.+]] = load double, ptr [[B_PRIV_ADDR]],
69 // CHECK: store double [[B_PRIV]], ptr [[B_BUF_IDX]],
70 // CHECK: br label %[[LOOP_CONTINUE:.+]]
72 // CHECK: [[DISPATCH]]:
73 // CHECK: br label %[[INPUT_PHASE]]
74 // CHECK: [[LOOP_CONTINUE]]:
75 // CHECK: call void @llvm.stackrestore.p0(ptr %
76 // CHECK: call void @__kmpc_for_static_fini(
77 // CHECK: call void @__kmpc_barrier(
78 foo(n);
79 #pragma omp scan inclusive(a[:n], b)
80 // CHECK: [[LOG2_10:%.+]] = call double @llvm.log2.f64(double 1.000000e+01)
81 // CHECK: [[CEIL_LOG2_10:%.+]] = call double @llvm.ceil.f64(double [[LOG2_10]])
82 // CHECK: [[CEIL_LOG2_10_INT:%.+]] = fptoui double [[CEIL_LOG2_10]] to i32
83 // CHECK: br label %[[OUTER_BODY:[^,]+]]
84 // CHECK: [[OUTER_BODY]]:
85 // CHECK: [[K:%.+]] = phi i32 [ 0, %{{.+}} ], [ [[K_NEXT:%.+]], %{{.+}} ]
86 // CHECK: [[K2POW:%.+]] = phi i64 [ 1, %{{.+}} ], [ [[K2POW_NEXT:%.+]], %{{.+}} ]
87 // CHECK: [[CMP:%.+]] = icmp uge i64 9, [[K2POW]]
88 // CHECK: br i1 [[CMP]], label %[[INNER_BODY:[^,]+]], label %[[INNER_EXIT:[^,]+]]
89 // CHECK: [[INNER_BODY]]:
90 // CHECK: [[I:%.+]] = phi i64 [ 9, %[[OUTER_BODY]] ], [ [[I_PREV:%.+]], %{{.+}} ]
92 // a_buffer[i] += a_buffer[i-pow(2, k)];
93 // CHECK: [[IDX:%.+]] = mul nsw i64 [[I]], [[NUM_ELEMS]]
94 // CHECK: [[A_BUF_IDX:%.+]] = getelementptr inbounds float, ptr [[A_BUF]], i64 [[IDX]]
95 // CHECK: [[IDX_SUB_K2POW:%.+]] = sub nuw i64 [[I]], [[K2POW]]
96 // CHECK: [[IDX:%.+]] = mul nsw i64 [[IDX_SUB_K2POW]], [[NUM_ELEMS]]
97 // CHECK: [[A_BUF_IDX_SUB_K2POW:%.+]] = getelementptr inbounds float, ptr [[A_BUF]], i64 [[IDX]]
98 // CHECK: [[B_BUF_IDX:%.+]] = getelementptr inbounds double, ptr [[B_BUF]], i64 [[I]]
99 // CHECK: [[IDX_SUB_K2POW:%.+]] = sub nuw i64 [[I]], [[K2POW]]
100 // CHECK: [[B_BUF_IDX_SUB_K2POW:%.+]] = getelementptr inbounds double, ptr [[B_BUF]], i64 [[IDX_SUB_K2POW]]
101 // CHECK: [[A_BUF_END:%.+]] = getelementptr float, ptr [[A_BUF_IDX]], i64 [[NUM_ELEMS]]
102 // CHECK: [[ISEMPTY:%.+]] = icmp eq ptr [[A_BUF_IDX]], [[A_BUF_END]]
103 // CHECK: br i1 [[ISEMPTY]], label %[[RED_DONE:[^,]+]], label %[[RED_BODY:[^,]+]]
104 // CHECK: [[RED_BODY]]:
105 // CHECK: [[A_BUF_IDX_SUB_K2POW_ELEM:%.+]] = phi ptr [ [[A_BUF_IDX_SUB_K2POW]], %[[INNER_BODY]] ], [ [[A_BUF_IDX_SUB_K2POW_NEXT:%.+]], %[[RED_BODY]] ]
106 // CHECK: [[A_BUF_IDX_ELEM:%.+]] = phi ptr [ [[A_BUF_IDX]], %[[INNER_BODY]] ], [ [[A_BUF_IDX_NEXT:%.+]], %[[RED_BODY]] ]
107 // CHECK: [[A_BUF_IDX_VAL:%.+]] = load float, ptr [[A_BUF_IDX_ELEM]],
108 // CHECK: [[A_BUF_IDX_SUB_K2POW_VAL:%.+]] = load float, ptr [[A_BUF_IDX_SUB_K2POW_ELEM]],
109 // CHECK: [[RED:%.+]] = fadd float [[A_BUF_IDX_VAL]], [[A_BUF_IDX_SUB_K2POW_VAL]]
110 // CHECK: store float [[RED]], ptr [[A_BUF_IDX_ELEM]],
111 // CHECK: [[A_BUF_IDX_NEXT]] = getelementptr float, ptr [[A_BUF_IDX_ELEM]], i32 1
112 // CHECK: [[A_BUF_IDX_SUB_K2POW_NEXT]] = getelementptr float, ptr [[A_BUF_IDX_SUB_K2POW_ELEM]], i32 1
113 // CHECK: [[DONE:%.+]] = icmp eq ptr [[A_BUF_IDX_NEXT]], [[A_BUF_END]]
114 // CHECK: br i1 [[DONE]], label %[[RED_DONE]], label %[[RED_BODY]]
115 // CHECK: [[RED_DONE]]:
117 // b_buffer[i] += b_buffer[i-pow(2, k)];
118 // CHECK: [[B_BUF_IDX_VAL:%.+]] = load double, ptr [[B_BUF_IDX]],
119 // CHECK: [[B_BUF_IDX_SUB_K2POW_VAL:%.+]] = load double, ptr [[B_BUF_IDX_SUB_K2POW]],
120 // CHECK: [[RED:%.+]] = fadd double [[B_BUF_IDX_VAL]], [[B_BUF_IDX_SUB_K2POW_VAL]]
121 // CHECK: store double [[RED]], ptr [[B_BUF_IDX]],
123 // --i;
124 // CHECK: [[I_PREV:%.+]] = sub nuw i64 [[I]], 1
125 // CHECK: [[CMP:%.+]] = icmp uge i64 [[I_PREV]], [[K2POW]]
126 // CHECK: br i1 [[CMP]], label %[[INNER_BODY]], label %[[INNER_EXIT]]
127 // CHECK: [[INNER_EXIT]]:
129 // ++k;
130 // CHECK: [[K_NEXT]] = add nuw i32 [[K]], 1
131 // k2pow <<= 1;
132 // CHECK: [[K2POW_NEXT]] = shl nuw i64 [[K2POW]], 1
133 // CHECK: [[CMP:%.+]] = icmp ne i32 [[K_NEXT]], [[CEIL_LOG2_10_INT]]
134 // CHECK: br i1 [[CMP]], label %[[OUTER_BODY]], label %[[OUTER_EXIT:[^,]+]]
135 // CHECK: [[OUTER_EXIT]]:
136 bar();
137 // CHECK: call void @__kmpc_for_static_init_4(
138 // CHECK: call ptr @llvm.stacksave.p0()
139 // CHECK: store float 0.000000e+00, ptr %
140 // CHECK: store double 0.000000e+00, ptr [[B_PRIV_ADDR:%.+]],
141 // CHECK: br label %[[DISPATCH:[^,]+]]
143 // Skip the before scan body.
144 // CHECK: call void @{{.+}}foo{{.+}}(
146 // CHECK: [[EXIT_INSCAN:[^,]+]]:
147 // CHECK: br label %[[LOOP_CONTINUE:[^,]+]]
149 // CHECK: [[DISPATCH]]:
150 // a_priv[[0..n] = a_buffer[i][0..n];
151 // CHECK: [[BASE_IDX_I:%.+]] = load i32, ptr [[IV_ADDR:%.+]],
152 // CHECK: [[BASE_IDX:%.+]] = zext i32 [[BASE_IDX_I]] to i64
153 // CHECK: [[IDX:%.+]] = mul nsw i64 [[BASE_IDX]], [[NUM_ELEMS]]
154 // CHECK: [[A_BUF_IDX:%.+]] = getelementptr inbounds float, ptr [[A_BUF]], i64 [[IDX]]
155 // CHECK: [[A_PRIV:%.+]] = getelementptr inbounds [10 x float], ptr [[A_PRIV_ADDR:%.+]], i64 0, i64 0
156 // CHECK: [[BYTES:%.+]] = mul nuw i64 [[NUM_ELEMS:%.+]], 4
157 // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}}[[A_PRIV]], ptr {{.*}}[[A_BUF_IDX]], i64 [[BYTES]], i1 false)
159 // b_priv = b_buffer[i];
160 // CHECK: [[B_BUF_IDX:%.+]] = getelementptr inbounds double, ptr [[B_BUF]], i64 [[BASE_IDX]]
161 // CHECK: [[B_BUF_IDX_VAL:%.+]] = load double, ptr [[B_BUF_IDX]],
162 // CHECK: store double [[B_BUF_IDX_VAL]], ptr [[B_PRIV_ADDR]],
163 // CHECK: br label %[[SCAN_PHASE:[^,]+]]
165 // CHECK: [[SCAN_PHASE]]:
166 // CHECK: call void @{{.+}}bar{{.+}}()
167 // CHECK: br label %[[EXIT_INSCAN]]
169 // CHECK: [[LOOP_CONTINUE]]:
170 // CHECK: call void @llvm.stackrestore.p0(ptr %
171 // CHECK: call void @__kmpc_for_static_fini(
174 #pragma omp parallel for reduction(inscan, +:a[:n], b)
175 for (int i = 0; i < 10; ++i) {
176 // CHECK: call void @__kmpc_for_static_init_4(
177 // CHECK: call ptr @llvm.stacksave.p0()
178 // CHECK: store float 0.000000e+00, ptr %
179 // CHECK: store double 0.000000e+00, ptr [[B_PRIV_ADDR:%.+]],
180 // CHECK: br label %[[DISPATCH:[^,]+]]
182 // Skip the before scan body.
183 // CHECK: call void @{{.+}}foo{{.+}}(
185 // CHECK: [[EXIT_INSCAN:[^,]+]]:
187 // a_buffer[i][0..n] = a_priv[[0..n];
188 // CHECK: [[BASE_IDX_I:%.+]] = load i32, ptr [[IV_ADDR:%.+]],
189 // CHECK: [[BASE_IDX:%.+]] = zext i32 [[BASE_IDX_I]] to i64
190 // CHECK: [[IDX:%.+]] = mul nsw i64 [[BASE_IDX]], [[NUM_ELEMS:%.+]]
191 // CHECK: [[A_BUF_IDX:%.+]] = getelementptr inbounds float, ptr [[A_BUF:%.+]], i64 [[IDX]]
192 // CHECK: [[A_PRIV:%.+]] = getelementptr inbounds [10 x float], ptr [[A_PRIV_ADDR:%.+]], i64 0, i64 0
193 // CHECK: [[BYTES:%.+]] = mul nuw i64 [[NUM_ELEMS:%.+]], 4
194 // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}}[[A_BUF_IDX]], ptr {{.*}}[[A_PRIV]], i64 [[BYTES]], i1 false)
196 // b_buffer[i] = b_priv;
197 // CHECK: [[B_BUF_IDX:%.+]] = getelementptr inbounds double, ptr [[B_BUF:%.+]], i64 [[BASE_IDX]]
198 // CHECK: [[B_PRIV:%.+]] = load double, ptr [[B_PRIV_ADDR]],
199 // CHECK: store double [[B_PRIV]], ptr [[B_BUF_IDX]],
200 // CHECK: br label %[[LOOP_CONTINUE:[^,]+]]
202 // CHECK: [[DISPATCH]]:
203 // CHECK: br label %[[INPUT_PHASE:[^,]+]]
205 // CHECK: [[INPUT_PHASE]]:
206 // CHECK: call void @{{.+}}bar{{.+}}()
207 // CHECK: br label %[[EXIT_INSCAN]]
209 // CHECK: [[LOOP_CONTINUE]]:
210 // CHECK: call void @llvm.stackrestore.p0(ptr %
211 // CHECK: call void @__kmpc_for_static_fini(
212 // CHECK: call void @__kmpc_barrier(
213 foo(n);
214 #pragma omp scan exclusive(a[:n], b)
215 // CHECK: [[LOG2_10:%.+]] = call double @llvm.log2.f64(double 1.000000e+01)
216 // CHECK: [[CEIL_LOG2_10:%.+]] = call double @llvm.ceil.f64(double [[LOG2_10]])
217 // CHECK: [[CEIL_LOG2_10_INT:%.+]] = fptoui double [[CEIL_LOG2_10]] to i32
218 // CHECK: br label %[[OUTER_BODY:[^,]+]]
219 // CHECK: [[OUTER_BODY]]:
220 // CHECK: [[K:%.+]] = phi i32 [ 0, %{{.+}} ], [ [[K_NEXT:%.+]], %{{.+}} ]
221 // CHECK: [[K2POW:%.+]] = phi i64 [ 1, %{{.+}} ], [ [[K2POW_NEXT:%.+]], %{{.+}} ]
222 // CHECK: [[CMP:%.+]] = icmp uge i64 9, [[K2POW]]
223 // CHECK: br i1 [[CMP]], label %[[INNER_BODY:[^,]+]], label %[[INNER_EXIT:[^,]+]]
224 // CHECK: [[INNER_BODY]]:
225 // CHECK: [[I:%.+]] = phi i64 [ 9, %[[OUTER_BODY]] ], [ [[I_PREV:%.+]], %{{.+}} ]
227 // a_buffer[i] += a_buffer[i-pow(2, k)];
228 // CHECK: [[IDX:%.+]] = mul nsw i64 [[I]], [[NUM_ELEMS]]
229 // CHECK: [[A_BUF_IDX:%.+]] = getelementptr inbounds float, ptr [[A_BUF]], i64 [[IDX]]
230 // CHECK: [[IDX_SUB_K2POW:%.+]] = sub nuw i64 [[I]], [[K2POW]]
231 // CHECK: [[IDX:%.+]] = mul nsw i64 [[IDX_SUB_K2POW]], [[NUM_ELEMS]]
232 // CHECK: [[A_BUF_IDX_SUB_K2POW:%.+]] = getelementptr inbounds float, ptr [[A_BUF]], i64 [[IDX]]
233 // CHECK: [[B_BUF_IDX:%.+]] = getelementptr inbounds double, ptr [[B_BUF]], i64 [[I]]
234 // CHECK: [[IDX_SUB_K2POW:%.+]] = sub nuw i64 [[I]], [[K2POW]]
235 // CHECK: [[B_BUF_IDX_SUB_K2POW:%.+]] = getelementptr inbounds double, ptr [[B_BUF]], i64 [[IDX_SUB_K2POW]]
236 // CHECK: [[A_BUF_END:%.+]] = getelementptr float, ptr [[A_BUF_IDX]], i64 [[NUM_ELEMS]]
237 // CHECK: [[ISEMPTY:%.+]] = icmp eq ptr [[A_BUF_IDX]], [[A_BUF_END]]
238 // CHECK: br i1 [[ISEMPTY]], label %[[RED_DONE:[^,]+]], label %[[RED_BODY:[^,]+]]
239 // CHECK: [[RED_BODY]]:
240 // CHECK: [[A_BUF_IDX_SUB_K2POW_ELEM:%.+]] = phi ptr [ [[A_BUF_IDX_SUB_K2POW]], %[[INNER_BODY]] ], [ [[A_BUF_IDX_SUB_K2POW_NEXT:%.+]], %[[RED_BODY]] ]
241 // CHECK: [[A_BUF_IDX_ELEM:%.+]] = phi ptr [ [[A_BUF_IDX]], %[[INNER_BODY]] ], [ [[A_BUF_IDX_NEXT:%.+]], %[[RED_BODY]] ]
242 // CHECK: [[A_BUF_IDX_VAL:%.+]] = load float, ptr [[A_BUF_IDX_ELEM]],
243 // CHECK: [[A_BUF_IDX_SUB_K2POW_VAL:%.+]] = load float, ptr [[A_BUF_IDX_SUB_K2POW_ELEM]],
244 // CHECK: [[RED:%.+]] = fadd float [[A_BUF_IDX_VAL]], [[A_BUF_IDX_SUB_K2POW_VAL]]
245 // CHECK: store float [[RED]], ptr [[A_BUF_IDX_ELEM]],
246 // CHECK: [[A_BUF_IDX_NEXT]] = getelementptr float, ptr [[A_BUF_IDX_ELEM]], i32 1
247 // CHECK: [[A_BUF_IDX_SUB_K2POW_NEXT]] = getelementptr float, ptr [[A_BUF_IDX_SUB_K2POW_ELEM]], i32 1
248 // CHECK: [[DONE:%.+]] = icmp eq ptr [[A_BUF_IDX_NEXT]], [[A_BUF_END]]
249 // CHECK: br i1 [[DONE]], label %[[RED_DONE]], label %[[RED_BODY]]
250 // CHECK: [[RED_DONE]]:
252 // b_buffer[i] += b_buffer[i-pow(2, k)];
253 // CHECK: [[B_BUF_IDX_VAL:%.+]] = load double, ptr [[B_BUF_IDX]],
254 // CHECK: [[B_BUF_IDX_SUB_K2POW_VAL:%.+]] = load double, ptr [[B_BUF_IDX_SUB_K2POW]],
255 // CHECK: [[RED:%.+]] = fadd double [[B_BUF_IDX_VAL]], [[B_BUF_IDX_SUB_K2POW_VAL]]
256 // CHECK: store double [[RED]], ptr [[B_BUF_IDX]],
258 // --i;
259 // CHECK: [[I_PREV:%.+]] = sub nuw i64 [[I]], 1
260 // CHECK: [[CMP:%.+]] = icmp uge i64 [[I_PREV]], [[K2POW]]
261 // CHECK: br i1 [[CMP]], label %[[INNER_BODY]], label %[[INNER_EXIT]]
262 // CHECK: [[INNER_EXIT]]:
264 // ++k;
265 // CHECK: [[K_NEXT]] = add nuw i32 [[K]], 1
266 // k2pow <<= 1;
267 // CHECK: [[K2POW_NEXT]] = shl nuw i64 [[K2POW]], 1
268 // CHECK: [[CMP:%.+]] = icmp ne i32 [[K_NEXT]], [[CEIL_LOG2_10_INT]]
269 // CHECK: br i1 [[CMP]], label %[[OUTER_BODY]], label %[[OUTER_EXIT:[^,]+]]
270 // CHECK: [[OUTER_EXIT]]:
271 bar();
272 // CHECK: call void @__kmpc_for_static_init_4(
273 // CHECK: call ptr @llvm.stacksave.p0()
274 // CHECK: store float 0.000000e+00, ptr %
275 // CHECK: store double 0.000000e+00, ptr [[B_PRIV_ADDR:%.+]],
276 // CHECK: br label %[[DISPATCH:[^,]+]]
278 // CHECK: [[SCAN_PHASE:.+]]:
279 // CHECK: call void @{{.+}}foo{{.+}}(
280 // CHECK: br label %[[LOOP_CONTINUE:.+]]
282 // CHECK: [[DISPATCH]]:
283 // if (i >0)
284 // a_priv[[0..n] = a_buffer[i-1][0..n];
285 // CHECK: [[BASE_IDX_I:%.+]] = load i32, ptr [[IV_ADDR:%.+]],
286 // CHECK: [[BASE_IDX:%.+]] = zext i32 [[BASE_IDX_I]] to i64
287 // CHECK: [[CMP:%.+]] = icmp eq i64 [[BASE_IDX]], 0
288 // CHECK: br i1 [[CMP]], label %[[IF_DONE:[^,]+]], label %[[IF_THEN:[^,]+]]
289 // CHECK: [[IF_THEN]]:
290 // CHECK: [[BASE_IDX_SUB_1:%.+]] = sub nuw i64 [[BASE_IDX]], 1
291 // CHECK: [[IDX:%.+]] = mul nsw i64 [[BASE_IDX_SUB_1]], [[NUM_ELEMS]]
292 // CHECK: [[A_BUF_IDX:%.+]] = getelementptr inbounds float, ptr [[A_BUF]], i64 [[IDX]]
293 // CHECK: [[A_PRIV:%.+]] = getelementptr inbounds [10 x float], ptr [[A_PRIV_ADDR:%.+]], i64 0, i64 0
294 // CHECK: [[BYTES:%.+]] = mul nuw i64 [[NUM_ELEMS:%.+]], 4
295 // CHECK: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}}[[A_PRIV]], ptr {{.*}}[[A_BUF_IDX]], i64 [[BYTES]], i1 false)
297 // b_priv = b_buffer[i];
298 // CHECK: [[B_BUF_IDX:%.+]] = getelementptr inbounds double, ptr [[B_BUF]], i64 [[BASE_IDX_SUB_1]]
299 // CHECK: [[B_BUF_IDX_VAL:%.+]] = load double, ptr [[B_BUF_IDX]],
300 // CHECK: store double [[B_BUF_IDX_VAL]], ptr [[B_PRIV_ADDR]],
301 // CHECK: br label %[[SCAN_PHASE]]
303 // CHECK: [[LOOP_CONTINUE]]:
304 // CHECK: call void @llvm.stackrestore.p0(ptr %
305 // CHECK: call void @__kmpc_for_static_fini(
309 #endif