Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / sections_private_codegen.cpp
blob77f9a562133f0cd5159d3745a6c1e5cdcf93a72c
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --include-generated-funcs --replace-value-regex "__omp_offloading_[0-9a-z]+_[0-9a-z]+" "reduction_size[.].+[.]" "pl_cond[.].+[.|,]" --prefix-filecheck-ir-name _
2 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK1
3 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -emit-pch -o %t %s
4 // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK1
5 // RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DLAMBDA -triple x86_64-unknown-linux -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK3
6 // RUN: %clang_cc1 -verify -fopenmp -x c++ -fblocks -DBLOCKS -triple x86_64-unknown-linux -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK4
8 // RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
9 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple x86_64-unknown-unknown -emit-pch -o %t %s
10 // RUN: %clang_cc1 -fopenmp-simd -x c++ -triple x86_64-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
11 // RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -std=c++11 -DLAMBDA -triple x86_64-unknown-linux -emit-llvm %s -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
12 // RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -fblocks -DBLOCKS -triple x86_64-unknown-linux -emit-llvm %s -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
13 // expected-no-diagnostics
14 #ifndef HEADER
15 #define HEADER
17 template <class T>
18 struct S {
19 T f;
20 S(T a) : f(a) {}
21 S() : f() {}
22 operator T() { return T(); }
23 ~S() {}
26 volatile double g;
28 template <typename T>
29 T tmain() {
30 S<T> test;
31 T t_var = T();
32 T vec[] = {1, 2};
33 S<T> s_arr[] = {1, 2};
34 S<T> var(3);
35 #pragma omp parallel
36 #pragma omp sections private(t_var, vec, s_arr, s_arr, var, var)
38 vec[0] = t_var;
39 #pragma omp section
40 s_arr[0] = var;
42 return T();
45 int main() {
46 static int sivar;
47 #ifdef LAMBDA
48 [&]() {
49 #pragma omp parallel
50 #pragma omp sections private(g, sivar)
53 g = 1;
54 sivar = 11;
56 #pragma omp section
57 [&]() {
58 g = 2;
59 sivar = 22;
62 }();
64 }();
65 return 0;
66 #elif defined(BLOCKS)
68 #pragma omp parallel
69 #pragma omp sections private(g, sivar)
72 g = 1;
73 sivar = 111;
75 #pragma omp section
77 g = 2;
78 sivar = 222;
79 }();
81 }();
82 return 0;
83 #else
84 S<float> test;
85 int t_var = 0;
86 int vec[] = {1, 2};
87 S<float> s_arr[] = {1, 2};
88 S<float> var(3);
89 #pragma omp parallel
90 #pragma omp sections private(t_var, vec, s_arr, s_arr, var, var, sivar)
93 vec[0] = t_var;
94 s_arr[0] = var;
95 sivar = 2;
98 return tmain<int>();
99 #endif
105 #endif
107 // CHECK1-LABEL: define {{[^@]+}}@main
108 // CHECK1-SAME: () #[[ATTR0:[0-9]+]] {
109 // CHECK1-NEXT: entry:
110 // CHECK1-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
111 // CHECK1-NEXT: [[TEST:%.*]] = alloca [[STRUCT_S:%.*]], align 4
112 // CHECK1-NEXT: [[T_VAR:%.*]] = alloca i32, align 4
113 // CHECK1-NEXT: [[VEC:%.*]] = alloca [2 x i32], align 4
114 // CHECK1-NEXT: [[S_ARR:%.*]] = alloca [2 x %struct.S], align 4
115 // CHECK1-NEXT: [[VAR:%.*]] = alloca [[STRUCT_S]], align 4
116 // CHECK1-NEXT: store i32 0, ptr [[RETVAL]], align 4
117 // CHECK1-NEXT: call void @_ZN1SIfEC1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[TEST]])
118 // CHECK1-NEXT: store i32 0, ptr [[T_VAR]], align 4
119 // CHECK1-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[VEC]], ptr align 4 @__const.main.vec, i64 8, i1 false)
120 // CHECK1-NEXT: [[ARRAYINIT_BEGIN:%.*]] = getelementptr inbounds [2 x %struct.S], ptr [[S_ARR]], i64 0, i64 0
121 // CHECK1-NEXT: call void @_ZN1SIfEC1Ef(ptr noundef nonnull align 4 dereferenceable(4) [[ARRAYINIT_BEGIN]], float noundef 1.000000e+00)
122 // CHECK1-NEXT: [[ARRAYINIT_ELEMENT:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[ARRAYINIT_BEGIN]], i64 1
123 // CHECK1-NEXT: call void @_ZN1SIfEC1Ef(ptr noundef nonnull align 4 dereferenceable(4) [[ARRAYINIT_ELEMENT]], float noundef 2.000000e+00)
124 // CHECK1-NEXT: call void @_ZN1SIfEC1Ef(ptr noundef nonnull align 4 dereferenceable(4) [[VAR]], float noundef 3.000000e+00)
125 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB3:[0-9]+]], i32 0, ptr @main.omp_outlined)
126 // CHECK1-NEXT: [[CALL:%.*]] = call noundef i32 @_Z5tmainIiET_v()
127 // CHECK1-NEXT: store i32 [[CALL]], ptr [[RETVAL]], align 4
128 // CHECK1-NEXT: call void @_ZN1SIfED1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[VAR]]) #[[ATTR4:[0-9]+]]
129 // CHECK1-NEXT: [[ARRAY_BEGIN:%.*]] = getelementptr inbounds [2 x %struct.S], ptr [[S_ARR]], i32 0, i32 0
130 // CHECK1-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[ARRAY_BEGIN]], i64 2
131 // CHECK1-NEXT: br label [[ARRAYDESTROY_BODY:%.*]]
132 // CHECK1: arraydestroy.body:
133 // CHECK1-NEXT: [[ARRAYDESTROY_ELEMENTPAST:%.*]] = phi ptr [ [[TMP0]], [[ENTRY:%.*]] ], [ [[ARRAYDESTROY_ELEMENT:%.*]], [[ARRAYDESTROY_BODY]] ]
134 // CHECK1-NEXT: [[ARRAYDESTROY_ELEMENT]] = getelementptr inbounds [[STRUCT_S]], ptr [[ARRAYDESTROY_ELEMENTPAST]], i64 -1
135 // CHECK1-NEXT: call void @_ZN1SIfED1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[ARRAYDESTROY_ELEMENT]]) #[[ATTR4]]
136 // CHECK1-NEXT: [[ARRAYDESTROY_DONE:%.*]] = icmp eq ptr [[ARRAYDESTROY_ELEMENT]], [[ARRAY_BEGIN]]
137 // CHECK1-NEXT: br i1 [[ARRAYDESTROY_DONE]], label [[ARRAYDESTROY_DONE1:%.*]], label [[ARRAYDESTROY_BODY]]
138 // CHECK1: arraydestroy.done1:
139 // CHECK1-NEXT: call void @_ZN1SIfED1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[TEST]]) #[[ATTR4]]
140 // CHECK1-NEXT: [[TMP1:%.*]] = load i32, ptr [[RETVAL]], align 4
141 // CHECK1-NEXT: ret i32 [[TMP1]]
144 // CHECK1-LABEL: define {{[^@]+}}@_ZN1SIfEC1Ev
145 // CHECK1-SAME: (ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]]) unnamed_addr #[[ATTR1:[0-9]+]] comdat align 2 {
146 // CHECK1-NEXT: entry:
147 // CHECK1-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8
148 // CHECK1-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8
149 // CHECK1-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8
150 // CHECK1-NEXT: call void @_ZN1SIfEC2Ev(ptr noundef nonnull align 4 dereferenceable(4) [[THIS1]])
151 // CHECK1-NEXT: ret void
154 // CHECK1-LABEL: define {{[^@]+}}@_ZN1SIfEC1Ef
155 // CHECK1-SAME: (ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]], float noundef [[A:%.*]]) unnamed_addr #[[ATTR1]] comdat align 2 {
156 // CHECK1-NEXT: entry:
157 // CHECK1-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8
158 // CHECK1-NEXT: [[A_ADDR:%.*]] = alloca float, align 4
159 // CHECK1-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8
160 // CHECK1-NEXT: store float [[A]], ptr [[A_ADDR]], align 4
161 // CHECK1-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8
162 // CHECK1-NEXT: [[TMP0:%.*]] = load float, ptr [[A_ADDR]], align 4
163 // CHECK1-NEXT: call void @_ZN1SIfEC2Ef(ptr noundef nonnull align 4 dereferenceable(4) [[THIS1]], float noundef [[TMP0]])
164 // CHECK1-NEXT: ret void
167 // CHECK1-LABEL: define {{[^@]+}}@main.omp_outlined
168 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]]) #[[ATTR3:[0-9]+]] {
169 // CHECK1-NEXT: entry:
170 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
171 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
172 // CHECK1-NEXT: [[DOTOMP_SECTIONS_LB_:%.*]] = alloca i32, align 4
173 // CHECK1-NEXT: [[DOTOMP_SECTIONS_UB_:%.*]] = alloca i32, align 4
174 // CHECK1-NEXT: [[DOTOMP_SECTIONS_ST_:%.*]] = alloca i32, align 4
175 // CHECK1-NEXT: [[DOTOMP_SECTIONS_IL_:%.*]] = alloca i32, align 4
176 // CHECK1-NEXT: [[DOTOMP_SECTIONS_IV_:%.*]] = alloca i32, align 4
177 // CHECK1-NEXT: [[T_VAR:%.*]] = alloca i32, align 4
178 // CHECK1-NEXT: [[VEC:%.*]] = alloca [2 x i32], align 4
179 // CHECK1-NEXT: [[S_ARR:%.*]] = alloca [2 x %struct.S], align 4
180 // CHECK1-NEXT: [[VAR:%.*]] = alloca [[STRUCT_S:%.*]], align 4
181 // CHECK1-NEXT: [[SIVAR:%.*]] = alloca i32, align 4
182 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
183 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
184 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_LB_]], align 4
185 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_UB_]], align 4
186 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_SECTIONS_ST_]], align 4
187 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_IL_]], align 4
188 // CHECK1-NEXT: [[ARRAY_BEGIN:%.*]] = getelementptr inbounds [2 x %struct.S], ptr [[S_ARR]], i32 0, i32 0
189 // CHECK1-NEXT: [[ARRAYCTOR_END:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[ARRAY_BEGIN]], i64 2
190 // CHECK1-NEXT: br label [[ARRAYCTOR_LOOP:%.*]]
191 // CHECK1: arrayctor.loop:
192 // CHECK1-NEXT: [[ARRAYCTOR_CUR:%.*]] = phi ptr [ [[ARRAY_BEGIN]], [[ENTRY:%.*]] ], [ [[ARRAYCTOR_NEXT:%.*]], [[ARRAYCTOR_LOOP]] ]
193 // CHECK1-NEXT: call void @_ZN1SIfEC1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[ARRAYCTOR_CUR]])
194 // CHECK1-NEXT: [[ARRAYCTOR_NEXT]] = getelementptr inbounds [[STRUCT_S]], ptr [[ARRAYCTOR_CUR]], i64 1
195 // CHECK1-NEXT: [[ARRAYCTOR_DONE:%.*]] = icmp eq ptr [[ARRAYCTOR_NEXT]], [[ARRAYCTOR_END]]
196 // CHECK1-NEXT: br i1 [[ARRAYCTOR_DONE]], label [[ARRAYCTOR_CONT:%.*]], label [[ARRAYCTOR_LOOP]]
197 // CHECK1: arrayctor.cont:
198 // CHECK1-NEXT: call void @_ZN1SIfEC1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[VAR]])
199 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
200 // CHECK1-NEXT: [[TMP1:%.*]] = load i32, ptr [[TMP0]], align 4
201 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1:[0-9]+]], i32 [[TMP1]], i32 34, ptr [[DOTOMP_SECTIONS_IL_]], ptr [[DOTOMP_SECTIONS_LB_]], ptr [[DOTOMP_SECTIONS_UB_]], ptr [[DOTOMP_SECTIONS_ST_]], i32 1, i32 1)
202 // CHECK1-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_]], align 4
203 // CHECK1-NEXT: [[TMP3:%.*]] = icmp slt i32 [[TMP2]], 0
204 // CHECK1-NEXT: [[TMP4:%.*]] = select i1 [[TMP3]], i32 [[TMP2]], i32 0
205 // CHECK1-NEXT: store i32 [[TMP4]], ptr [[DOTOMP_SECTIONS_UB_]], align 4
206 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_LB_]], align 4
207 // CHECK1-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_SECTIONS_IV_]], align 4
208 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
209 // CHECK1: omp.inner.for.cond:
210 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
211 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_]], align 4
212 // CHECK1-NEXT: [[CMP:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
213 // CHECK1-NEXT: br i1 [[CMP]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
214 // CHECK1: omp.inner.for.body:
215 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
216 // CHECK1-NEXT: switch i32 [[TMP8]], label [[DOTOMP_SECTIONS_EXIT:%.*]] [
217 // CHECK1-NEXT: i32 0, label [[DOTOMP_SECTIONS_CASE:%.*]]
218 // CHECK1-NEXT: ]
219 // CHECK1: .omp.sections.case:
220 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[T_VAR]], align 4
221 // CHECK1-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [2 x i32], ptr [[VEC]], i64 0, i64 0
222 // CHECK1-NEXT: store i32 [[TMP9]], ptr [[ARRAYIDX]], align 4
223 // CHECK1-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds [2 x %struct.S], ptr [[S_ARR]], i64 0, i64 0
224 // CHECK1-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[ARRAYIDX1]], ptr align 4 [[VAR]], i64 4, i1 false)
225 // CHECK1-NEXT: store i32 2, ptr [[SIVAR]], align 4
226 // CHECK1-NEXT: br label [[DOTOMP_SECTIONS_EXIT]]
227 // CHECK1: .omp.sections.exit:
228 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
229 // CHECK1: omp.inner.for.inc:
230 // CHECK1-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
231 // CHECK1-NEXT: [[INC:%.*]] = add nsw i32 [[TMP10]], 1
232 // CHECK1-NEXT: store i32 [[INC]], ptr [[DOTOMP_SECTIONS_IV_]], align 4
233 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]]
234 // CHECK1: omp.inner.for.end:
235 // CHECK1-NEXT: [[TMP11:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
236 // CHECK1-NEXT: [[TMP12:%.*]] = load i32, ptr [[TMP11]], align 4
237 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP12]])
238 // CHECK1-NEXT: call void @_ZN1SIfED1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[VAR]]) #[[ATTR4]]
239 // CHECK1-NEXT: [[ARRAY_BEGIN2:%.*]] = getelementptr inbounds [2 x %struct.S], ptr [[S_ARR]], i32 0, i32 0
240 // CHECK1-NEXT: [[TMP13:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[ARRAY_BEGIN2]], i64 2
241 // CHECK1-NEXT: br label [[ARRAYDESTROY_BODY:%.*]]
242 // CHECK1: arraydestroy.body:
243 // CHECK1-NEXT: [[ARRAYDESTROY_ELEMENTPAST:%.*]] = phi ptr [ [[TMP13]], [[OMP_INNER_FOR_END]] ], [ [[ARRAYDESTROY_ELEMENT:%.*]], [[ARRAYDESTROY_BODY]] ]
244 // CHECK1-NEXT: [[ARRAYDESTROY_ELEMENT]] = getelementptr inbounds [[STRUCT_S]], ptr [[ARRAYDESTROY_ELEMENTPAST]], i64 -1
245 // CHECK1-NEXT: call void @_ZN1SIfED1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[ARRAYDESTROY_ELEMENT]]) #[[ATTR4]]
246 // CHECK1-NEXT: [[ARRAYDESTROY_DONE:%.*]] = icmp eq ptr [[ARRAYDESTROY_ELEMENT]], [[ARRAY_BEGIN2]]
247 // CHECK1-NEXT: br i1 [[ARRAYDESTROY_DONE]], label [[ARRAYDESTROY_DONE3:%.*]], label [[ARRAYDESTROY_BODY]]
248 // CHECK1: arraydestroy.done3:
249 // CHECK1-NEXT: [[TMP14:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
250 // CHECK1-NEXT: [[TMP15:%.*]] = load i32, ptr [[TMP14]], align 4
251 // CHECK1-NEXT: call void @__kmpc_barrier(ptr @[[GLOB2:[0-9]+]], i32 [[TMP15]])
252 // CHECK1-NEXT: ret void
255 // CHECK1-LABEL: define {{[^@]+}}@_ZN1SIfED1Ev
256 // CHECK1-SAME: (ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]]) unnamed_addr #[[ATTR1]] comdat align 2 {
257 // CHECK1-NEXT: entry:
258 // CHECK1-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8
259 // CHECK1-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8
260 // CHECK1-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8
261 // CHECK1-NEXT: call void @_ZN1SIfED2Ev(ptr noundef nonnull align 4 dereferenceable(4) [[THIS1]]) #[[ATTR4]]
262 // CHECK1-NEXT: ret void
265 // CHECK1-LABEL: define {{[^@]+}}@_Z5tmainIiET_v
266 // CHECK1-SAME: () #[[ATTR6:[0-9]+]] comdat {
267 // CHECK1-NEXT: entry:
268 // CHECK1-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
269 // CHECK1-NEXT: [[TEST:%.*]] = alloca [[STRUCT_S_0:%.*]], align 4
270 // CHECK1-NEXT: [[T_VAR:%.*]] = alloca i32, align 4
271 // CHECK1-NEXT: [[VEC:%.*]] = alloca [2 x i32], align 4
272 // CHECK1-NEXT: [[S_ARR:%.*]] = alloca [2 x %struct.S.0], align 4
273 // CHECK1-NEXT: [[VAR:%.*]] = alloca [[STRUCT_S_0]], align 4
274 // CHECK1-NEXT: call void @_ZN1SIiEC1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[TEST]])
275 // CHECK1-NEXT: store i32 0, ptr [[T_VAR]], align 4
276 // CHECK1-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[VEC]], ptr align 4 @__const._Z5tmainIiET_v.vec, i64 8, i1 false)
277 // CHECK1-NEXT: [[ARRAYINIT_BEGIN:%.*]] = getelementptr inbounds [2 x %struct.S.0], ptr [[S_ARR]], i64 0, i64 0
278 // CHECK1-NEXT: call void @_ZN1SIiEC1Ei(ptr noundef nonnull align 4 dereferenceable(4) [[ARRAYINIT_BEGIN]], i32 noundef 1)
279 // CHECK1-NEXT: [[ARRAYINIT_ELEMENT:%.*]] = getelementptr inbounds [[STRUCT_S_0]], ptr [[ARRAYINIT_BEGIN]], i64 1
280 // CHECK1-NEXT: call void @_ZN1SIiEC1Ei(ptr noundef nonnull align 4 dereferenceable(4) [[ARRAYINIT_ELEMENT]], i32 noundef 2)
281 // CHECK1-NEXT: call void @_ZN1SIiEC1Ei(ptr noundef nonnull align 4 dereferenceable(4) [[VAR]], i32 noundef 3)
282 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB3]], i32 0, ptr @_Z5tmainIiET_v.omp_outlined)
283 // CHECK1-NEXT: store i32 0, ptr [[RETVAL]], align 4
284 // CHECK1-NEXT: call void @_ZN1SIiED1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[VAR]]) #[[ATTR4]]
285 // CHECK1-NEXT: [[ARRAY_BEGIN:%.*]] = getelementptr inbounds [2 x %struct.S.0], ptr [[S_ARR]], i32 0, i32 0
286 // CHECK1-NEXT: [[TMP0:%.*]] = getelementptr inbounds [[STRUCT_S_0]], ptr [[ARRAY_BEGIN]], i64 2
287 // CHECK1-NEXT: br label [[ARRAYDESTROY_BODY:%.*]]
288 // CHECK1: arraydestroy.body:
289 // CHECK1-NEXT: [[ARRAYDESTROY_ELEMENTPAST:%.*]] = phi ptr [ [[TMP0]], [[ENTRY:%.*]] ], [ [[ARRAYDESTROY_ELEMENT:%.*]], [[ARRAYDESTROY_BODY]] ]
290 // CHECK1-NEXT: [[ARRAYDESTROY_ELEMENT]] = getelementptr inbounds [[STRUCT_S_0]], ptr [[ARRAYDESTROY_ELEMENTPAST]], i64 -1
291 // CHECK1-NEXT: call void @_ZN1SIiED1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[ARRAYDESTROY_ELEMENT]]) #[[ATTR4]]
292 // CHECK1-NEXT: [[ARRAYDESTROY_DONE:%.*]] = icmp eq ptr [[ARRAYDESTROY_ELEMENT]], [[ARRAY_BEGIN]]
293 // CHECK1-NEXT: br i1 [[ARRAYDESTROY_DONE]], label [[ARRAYDESTROY_DONE1:%.*]], label [[ARRAYDESTROY_BODY]]
294 // CHECK1: arraydestroy.done1:
295 // CHECK1-NEXT: call void @_ZN1SIiED1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[TEST]]) #[[ATTR4]]
296 // CHECK1-NEXT: [[TMP1:%.*]] = load i32, ptr [[RETVAL]], align 4
297 // CHECK1-NEXT: ret i32 [[TMP1]]
300 // CHECK1-LABEL: define {{[^@]+}}@_ZN1SIfEC2Ev
301 // CHECK1-SAME: (ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]]) unnamed_addr #[[ATTR1]] comdat align 2 {
302 // CHECK1-NEXT: entry:
303 // CHECK1-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8
304 // CHECK1-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8
305 // CHECK1-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8
306 // CHECK1-NEXT: [[F:%.*]] = getelementptr inbounds [[STRUCT_S:%.*]], ptr [[THIS1]], i32 0, i32 0
307 // CHECK1-NEXT: store float 0.000000e+00, ptr [[F]], align 4
308 // CHECK1-NEXT: ret void
311 // CHECK1-LABEL: define {{[^@]+}}@_ZN1SIfEC2Ef
312 // CHECK1-SAME: (ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]], float noundef [[A:%.*]]) unnamed_addr #[[ATTR1]] comdat align 2 {
313 // CHECK1-NEXT: entry:
314 // CHECK1-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8
315 // CHECK1-NEXT: [[A_ADDR:%.*]] = alloca float, align 4
316 // CHECK1-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8
317 // CHECK1-NEXT: store float [[A]], ptr [[A_ADDR]], align 4
318 // CHECK1-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8
319 // CHECK1-NEXT: [[F:%.*]] = getelementptr inbounds [[STRUCT_S:%.*]], ptr [[THIS1]], i32 0, i32 0
320 // CHECK1-NEXT: [[TMP0:%.*]] = load float, ptr [[A_ADDR]], align 4
321 // CHECK1-NEXT: store float [[TMP0]], ptr [[F]], align 4
322 // CHECK1-NEXT: ret void
325 // CHECK1-LABEL: define {{[^@]+}}@_ZN1SIfED2Ev
326 // CHECK1-SAME: (ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]]) unnamed_addr #[[ATTR1]] comdat align 2 {
327 // CHECK1-NEXT: entry:
328 // CHECK1-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8
329 // CHECK1-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8
330 // CHECK1-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8
331 // CHECK1-NEXT: ret void
334 // CHECK1-LABEL: define {{[^@]+}}@_ZN1SIiEC1Ev
335 // CHECK1-SAME: (ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]]) unnamed_addr #[[ATTR1]] comdat align 2 {
336 // CHECK1-NEXT: entry:
337 // CHECK1-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8
338 // CHECK1-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8
339 // CHECK1-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8
340 // CHECK1-NEXT: call void @_ZN1SIiEC2Ev(ptr noundef nonnull align 4 dereferenceable(4) [[THIS1]])
341 // CHECK1-NEXT: ret void
344 // CHECK1-LABEL: define {{[^@]+}}@_ZN1SIiEC1Ei
345 // CHECK1-SAME: (ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]], i32 noundef [[A:%.*]]) unnamed_addr #[[ATTR1]] comdat align 2 {
346 // CHECK1-NEXT: entry:
347 // CHECK1-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8
348 // CHECK1-NEXT: [[A_ADDR:%.*]] = alloca i32, align 4
349 // CHECK1-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8
350 // CHECK1-NEXT: store i32 [[A]], ptr [[A_ADDR]], align 4
351 // CHECK1-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8
352 // CHECK1-NEXT: [[TMP0:%.*]] = load i32, ptr [[A_ADDR]], align 4
353 // CHECK1-NEXT: call void @_ZN1SIiEC2Ei(ptr noundef nonnull align 4 dereferenceable(4) [[THIS1]], i32 noundef [[TMP0]])
354 // CHECK1-NEXT: ret void
357 // CHECK1-LABEL: define {{[^@]+}}@_Z5tmainIiET_v.omp_outlined
358 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]]) #[[ATTR3]] {
359 // CHECK1-NEXT: entry:
360 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
361 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
362 // CHECK1-NEXT: [[DOTOMP_SECTIONS_LB_:%.*]] = alloca i32, align 4
363 // CHECK1-NEXT: [[DOTOMP_SECTIONS_UB_:%.*]] = alloca i32, align 4
364 // CHECK1-NEXT: [[DOTOMP_SECTIONS_ST_:%.*]] = alloca i32, align 4
365 // CHECK1-NEXT: [[DOTOMP_SECTIONS_IL_:%.*]] = alloca i32, align 4
366 // CHECK1-NEXT: [[DOTOMP_SECTIONS_IV_:%.*]] = alloca i32, align 4
367 // CHECK1-NEXT: [[T_VAR:%.*]] = alloca i32, align 4
368 // CHECK1-NEXT: [[VEC:%.*]] = alloca [2 x i32], align 4
369 // CHECK1-NEXT: [[S_ARR:%.*]] = alloca [2 x %struct.S.0], align 4
370 // CHECK1-NEXT: [[VAR:%.*]] = alloca [[STRUCT_S_0:%.*]], align 4
371 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
372 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
373 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_LB_]], align 4
374 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_SECTIONS_UB_]], align 4
375 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_SECTIONS_ST_]], align 4
376 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_IL_]], align 4
377 // CHECK1-NEXT: [[ARRAY_BEGIN:%.*]] = getelementptr inbounds [2 x %struct.S.0], ptr [[S_ARR]], i32 0, i32 0
378 // CHECK1-NEXT: [[ARRAYCTOR_END:%.*]] = getelementptr inbounds [[STRUCT_S_0]], ptr [[ARRAY_BEGIN]], i64 2
379 // CHECK1-NEXT: br label [[ARRAYCTOR_LOOP:%.*]]
380 // CHECK1: arrayctor.loop:
381 // CHECK1-NEXT: [[ARRAYCTOR_CUR:%.*]] = phi ptr [ [[ARRAY_BEGIN]], [[ENTRY:%.*]] ], [ [[ARRAYCTOR_NEXT:%.*]], [[ARRAYCTOR_LOOP]] ]
382 // CHECK1-NEXT: call void @_ZN1SIiEC1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[ARRAYCTOR_CUR]])
383 // CHECK1-NEXT: [[ARRAYCTOR_NEXT]] = getelementptr inbounds [[STRUCT_S_0]], ptr [[ARRAYCTOR_CUR]], i64 1
384 // CHECK1-NEXT: [[ARRAYCTOR_DONE:%.*]] = icmp eq ptr [[ARRAYCTOR_NEXT]], [[ARRAYCTOR_END]]
385 // CHECK1-NEXT: br i1 [[ARRAYCTOR_DONE]], label [[ARRAYCTOR_CONT:%.*]], label [[ARRAYCTOR_LOOP]]
386 // CHECK1: arrayctor.cont:
387 // CHECK1-NEXT: call void @_ZN1SIiEC1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[VAR]])
388 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
389 // CHECK1-NEXT: [[TMP1:%.*]] = load i32, ptr [[TMP0]], align 4
390 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1]], i32 [[TMP1]], i32 34, ptr [[DOTOMP_SECTIONS_IL_]], ptr [[DOTOMP_SECTIONS_LB_]], ptr [[DOTOMP_SECTIONS_UB_]], ptr [[DOTOMP_SECTIONS_ST_]], i32 1, i32 1)
391 // CHECK1-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_]], align 4
392 // CHECK1-NEXT: [[TMP3:%.*]] = icmp slt i32 [[TMP2]], 1
393 // CHECK1-NEXT: [[TMP4:%.*]] = select i1 [[TMP3]], i32 [[TMP2]], i32 1
394 // CHECK1-NEXT: store i32 [[TMP4]], ptr [[DOTOMP_SECTIONS_UB_]], align 4
395 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_LB_]], align 4
396 // CHECK1-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_SECTIONS_IV_]], align 4
397 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
398 // CHECK1: omp.inner.for.cond:
399 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
400 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_]], align 4
401 // CHECK1-NEXT: [[CMP:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
402 // CHECK1-NEXT: br i1 [[CMP]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
403 // CHECK1: omp.inner.for.body:
404 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
405 // CHECK1-NEXT: switch i32 [[TMP8]], label [[DOTOMP_SECTIONS_EXIT:%.*]] [
406 // CHECK1-NEXT: i32 0, label [[DOTOMP_SECTIONS_CASE:%.*]]
407 // CHECK1-NEXT: i32 1, label [[DOTOMP_SECTIONS_CASE1:%.*]]
408 // CHECK1-NEXT: ]
409 // CHECK1: .omp.sections.case:
410 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[T_VAR]], align 4
411 // CHECK1-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [2 x i32], ptr [[VEC]], i64 0, i64 0
412 // CHECK1-NEXT: store i32 [[TMP9]], ptr [[ARRAYIDX]], align 4
413 // CHECK1-NEXT: br label [[DOTOMP_SECTIONS_EXIT]]
414 // CHECK1: .omp.sections.case1:
415 // CHECK1-NEXT: [[ARRAYIDX2:%.*]] = getelementptr inbounds [2 x %struct.S.0], ptr [[S_ARR]], i64 0, i64 0
416 // CHECK1-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[ARRAYIDX2]], ptr align 4 [[VAR]], i64 4, i1 false)
417 // CHECK1-NEXT: br label [[DOTOMP_SECTIONS_EXIT]]
418 // CHECK1: .omp.sections.exit:
419 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
420 // CHECK1: omp.inner.for.inc:
421 // CHECK1-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
422 // CHECK1-NEXT: [[INC:%.*]] = add nsw i32 [[TMP10]], 1
423 // CHECK1-NEXT: store i32 [[INC]], ptr [[DOTOMP_SECTIONS_IV_]], align 4
424 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]]
425 // CHECK1: omp.inner.for.end:
426 // CHECK1-NEXT: [[TMP11:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
427 // CHECK1-NEXT: [[TMP12:%.*]] = load i32, ptr [[TMP11]], align 4
428 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP12]])
429 // CHECK1-NEXT: call void @_ZN1SIiED1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[VAR]]) #[[ATTR4]]
430 // CHECK1-NEXT: [[ARRAY_BEGIN3:%.*]] = getelementptr inbounds [2 x %struct.S.0], ptr [[S_ARR]], i32 0, i32 0
431 // CHECK1-NEXT: [[TMP13:%.*]] = getelementptr inbounds [[STRUCT_S_0]], ptr [[ARRAY_BEGIN3]], i64 2
432 // CHECK1-NEXT: br label [[ARRAYDESTROY_BODY:%.*]]
433 // CHECK1: arraydestroy.body:
434 // CHECK1-NEXT: [[ARRAYDESTROY_ELEMENTPAST:%.*]] = phi ptr [ [[TMP13]], [[OMP_INNER_FOR_END]] ], [ [[ARRAYDESTROY_ELEMENT:%.*]], [[ARRAYDESTROY_BODY]] ]
435 // CHECK1-NEXT: [[ARRAYDESTROY_ELEMENT]] = getelementptr inbounds [[STRUCT_S_0]], ptr [[ARRAYDESTROY_ELEMENTPAST]], i64 -1
436 // CHECK1-NEXT: call void @_ZN1SIiED1Ev(ptr noundef nonnull align 4 dereferenceable(4) [[ARRAYDESTROY_ELEMENT]]) #[[ATTR4]]
437 // CHECK1-NEXT: [[ARRAYDESTROY_DONE:%.*]] = icmp eq ptr [[ARRAYDESTROY_ELEMENT]], [[ARRAY_BEGIN3]]
438 // CHECK1-NEXT: br i1 [[ARRAYDESTROY_DONE]], label [[ARRAYDESTROY_DONE4:%.*]], label [[ARRAYDESTROY_BODY]]
439 // CHECK1: arraydestroy.done4:
440 // CHECK1-NEXT: [[TMP14:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
441 // CHECK1-NEXT: [[TMP15:%.*]] = load i32, ptr [[TMP14]], align 4
442 // CHECK1-NEXT: call void @__kmpc_barrier(ptr @[[GLOB2]], i32 [[TMP15]])
443 // CHECK1-NEXT: ret void
446 // CHECK1-LABEL: define {{[^@]+}}@_ZN1SIiED1Ev
447 // CHECK1-SAME: (ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]]) unnamed_addr #[[ATTR1]] comdat align 2 {
448 // CHECK1-NEXT: entry:
449 // CHECK1-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8
450 // CHECK1-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8
451 // CHECK1-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8
452 // CHECK1-NEXT: call void @_ZN1SIiED2Ev(ptr noundef nonnull align 4 dereferenceable(4) [[THIS1]]) #[[ATTR4]]
453 // CHECK1-NEXT: ret void
456 // CHECK1-LABEL: define {{[^@]+}}@_ZN1SIiEC2Ev
457 // CHECK1-SAME: (ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]]) unnamed_addr #[[ATTR1]] comdat align 2 {
458 // CHECK1-NEXT: entry:
459 // CHECK1-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8
460 // CHECK1-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8
461 // CHECK1-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8
462 // CHECK1-NEXT: [[F:%.*]] = getelementptr inbounds [[STRUCT_S_0:%.*]], ptr [[THIS1]], i32 0, i32 0
463 // CHECK1-NEXT: store i32 0, ptr [[F]], align 4
464 // CHECK1-NEXT: ret void
467 // CHECK1-LABEL: define {{[^@]+}}@_ZN1SIiEC2Ei
468 // CHECK1-SAME: (ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]], i32 noundef [[A:%.*]]) unnamed_addr #[[ATTR1]] comdat align 2 {
469 // CHECK1-NEXT: entry:
470 // CHECK1-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8
471 // CHECK1-NEXT: [[A_ADDR:%.*]] = alloca i32, align 4
472 // CHECK1-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8
473 // CHECK1-NEXT: store i32 [[A]], ptr [[A_ADDR]], align 4
474 // CHECK1-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8
475 // CHECK1-NEXT: [[F:%.*]] = getelementptr inbounds [[STRUCT_S_0:%.*]], ptr [[THIS1]], i32 0, i32 0
476 // CHECK1-NEXT: [[TMP0:%.*]] = load i32, ptr [[A_ADDR]], align 4
477 // CHECK1-NEXT: store i32 [[TMP0]], ptr [[F]], align 4
478 // CHECK1-NEXT: ret void
481 // CHECK1-LABEL: define {{[^@]+}}@_ZN1SIiED2Ev
482 // CHECK1-SAME: (ptr noundef nonnull align 4 dereferenceable(4) [[THIS:%.*]]) unnamed_addr #[[ATTR1]] comdat align 2 {
483 // CHECK1-NEXT: entry:
484 // CHECK1-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8
485 // CHECK1-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8
486 // CHECK1-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8
487 // CHECK1-NEXT: ret void
490 // CHECK3-LABEL: define {{[^@]+}}@main
491 // CHECK3-SAME: () #[[ATTR0:[0-9]+]] {
492 // CHECK3-NEXT: entry:
493 // CHECK3-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
494 // CHECK3-NEXT: [[REF_TMP:%.*]] = alloca [[CLASS_ANON:%.*]], align 1
495 // CHECK3-NEXT: store i32 0, ptr [[RETVAL]], align 4
496 // CHECK3-NEXT: call void @"_ZZ4mainENK3$_0clEv"(ptr noundef nonnull align 1 dereferenceable(1) [[REF_TMP]])
497 // CHECK3-NEXT: ret i32 0
500 // CHECK4-LABEL: define {{[^@]+}}@main
501 // CHECK4-SAME: () #[[ATTR1:[0-9]+]] {
502 // CHECK4-NEXT: entry:
503 // CHECK4-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
504 // CHECK4-NEXT: store i32 0, ptr [[RETVAL]], align 4
505 // CHECK4-NEXT: [[TMP0:%.*]] = load ptr, ptr getelementptr inbounds ([[STRUCT___BLOCK_LITERAL_GENERIC:%.*]], ptr @__block_literal_global, i32 0, i32 3), align 8
506 // CHECK4-NEXT: call void [[TMP0]](ptr noundef @__block_literal_global)
507 // CHECK4-NEXT: ret i32 0
510 // CHECK4-LABEL: define {{[^@]+}}@__main_block_invoke
511 // CHECK4-SAME: (ptr noundef [[DOTBLOCK_DESCRIPTOR:%.*]]) #[[ATTR2:[0-9]+]] {
512 // CHECK4-NEXT: entry:
513 // CHECK4-NEXT: [[DOTBLOCK_DESCRIPTOR_ADDR:%.*]] = alloca ptr, align 8
514 // CHECK4-NEXT: [[BLOCK_ADDR:%.*]] = alloca ptr, align 8
515 // CHECK4-NEXT: store ptr [[DOTBLOCK_DESCRIPTOR]], ptr [[DOTBLOCK_DESCRIPTOR_ADDR]], align 8
516 // CHECK4-NEXT: store ptr [[DOTBLOCK_DESCRIPTOR]], ptr [[BLOCK_ADDR]], align 8
517 // CHECK4-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB3:[0-9]+]], i32 0, ptr @__main_block_invoke.omp_outlined)
518 // CHECK4-NEXT: ret void
521 // CHECK4-LABEL: define {{[^@]+}}@__main_block_invoke.omp_outlined
522 // CHECK4-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]]) #[[ATTR3:[0-9]+]] {
523 // CHECK4-NEXT: entry:
524 // CHECK4-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
525 // CHECK4-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
526 // CHECK4-NEXT: [[DOTOMP_SECTIONS_LB_:%.*]] = alloca i32, align 4
527 // CHECK4-NEXT: [[DOTOMP_SECTIONS_UB_:%.*]] = alloca i32, align 4
528 // CHECK4-NEXT: [[DOTOMP_SECTIONS_ST_:%.*]] = alloca i32, align 4
529 // CHECK4-NEXT: [[DOTOMP_SECTIONS_IL_:%.*]] = alloca i32, align 4
530 // CHECK4-NEXT: [[DOTOMP_SECTIONS_IV_:%.*]] = alloca i32, align 4
531 // CHECK4-NEXT: [[G:%.*]] = alloca double, align 8
532 // CHECK4-NEXT: [[SIVAR:%.*]] = alloca i32, align 4
533 // CHECK4-NEXT: [[BLOCK:%.*]] = alloca <{ ptr, i32, i32, ptr, ptr, double, i32 }>, align 8
534 // CHECK4-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
535 // CHECK4-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
536 // CHECK4-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_LB_]], align 4
537 // CHECK4-NEXT: store i32 1, ptr [[DOTOMP_SECTIONS_UB_]], align 4
538 // CHECK4-NEXT: store i32 1, ptr [[DOTOMP_SECTIONS_ST_]], align 4
539 // CHECK4-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_IL_]], align 4
540 // CHECK4-NEXT: [[TMP0:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
541 // CHECK4-NEXT: [[TMP1:%.*]] = load i32, ptr [[TMP0]], align 4
542 // CHECK4-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1:[0-9]+]], i32 [[TMP1]], i32 34, ptr [[DOTOMP_SECTIONS_IL_]], ptr [[DOTOMP_SECTIONS_LB_]], ptr [[DOTOMP_SECTIONS_UB_]], ptr [[DOTOMP_SECTIONS_ST_]], i32 1, i32 1)
543 // CHECK4-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_]], align 4
544 // CHECK4-NEXT: [[TMP3:%.*]] = icmp slt i32 [[TMP2]], 1
545 // CHECK4-NEXT: [[TMP4:%.*]] = select i1 [[TMP3]], i32 [[TMP2]], i32 1
546 // CHECK4-NEXT: store i32 [[TMP4]], ptr [[DOTOMP_SECTIONS_UB_]], align 4
547 // CHECK4-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_LB_]], align 4
548 // CHECK4-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_SECTIONS_IV_]], align 4
549 // CHECK4-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
550 // CHECK4: omp.inner.for.cond:
551 // CHECK4-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
552 // CHECK4-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_]], align 4
553 // CHECK4-NEXT: [[CMP:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
554 // CHECK4-NEXT: br i1 [[CMP]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
555 // CHECK4: omp.inner.for.body:
556 // CHECK4-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
557 // CHECK4-NEXT: switch i32 [[TMP8]], label [[DOTOMP_SECTIONS_EXIT:%.*]] [
558 // CHECK4-NEXT: i32 0, label [[DOTOMP_SECTIONS_CASE:%.*]]
559 // CHECK4-NEXT: i32 1, label [[DOTOMP_SECTIONS_CASE1:%.*]]
560 // CHECK4-NEXT: ]
561 // CHECK4: .omp.sections.case:
562 // CHECK4-NEXT: store double 1.000000e+00, ptr [[G]], align 8
563 // CHECK4-NEXT: store i32 111, ptr [[SIVAR]], align 4
564 // CHECK4-NEXT: br label [[DOTOMP_SECTIONS_EXIT]]
565 // CHECK4: .omp.sections.case1:
566 // CHECK4-NEXT: [[BLOCK_ISA:%.*]] = getelementptr inbounds <{ ptr, i32, i32, ptr, ptr, double, i32 }>, ptr [[BLOCK]], i32 0, i32 0
567 // CHECK4-NEXT: store ptr @_NSConcreteStackBlock, ptr [[BLOCK_ISA]], align 8
568 // CHECK4-NEXT: [[BLOCK_FLAGS:%.*]] = getelementptr inbounds <{ ptr, i32, i32, ptr, ptr, double, i32 }>, ptr [[BLOCK]], i32 0, i32 1
569 // CHECK4-NEXT: store i32 1073741824, ptr [[BLOCK_FLAGS]], align 8
570 // CHECK4-NEXT: [[BLOCK_RESERVED:%.*]] = getelementptr inbounds <{ ptr, i32, i32, ptr, ptr, double, i32 }>, ptr [[BLOCK]], i32 0, i32 2
571 // CHECK4-NEXT: store i32 0, ptr [[BLOCK_RESERVED]], align 4
572 // CHECK4-NEXT: [[BLOCK_INVOKE:%.*]] = getelementptr inbounds <{ ptr, i32, i32, ptr, ptr, double, i32 }>, ptr [[BLOCK]], i32 0, i32 3
573 // CHECK4-NEXT: store ptr @_block_invoke, ptr [[BLOCK_INVOKE]], align 8
574 // CHECK4-NEXT: [[BLOCK_DESCRIPTOR:%.*]] = getelementptr inbounds <{ ptr, i32, i32, ptr, ptr, double, i32 }>, ptr [[BLOCK]], i32 0, i32 4
575 // CHECK4-NEXT: store ptr @__block_descriptor_tmp.1, ptr [[BLOCK_DESCRIPTOR]], align 8
576 // CHECK4-NEXT: [[BLOCK_CAPTURED:%.*]] = getelementptr inbounds <{ ptr, i32, i32, ptr, ptr, double, i32 }>, ptr [[BLOCK]], i32 0, i32 5
577 // CHECK4-NEXT: [[TMP9:%.*]] = load volatile double, ptr [[G]], align 8
578 // CHECK4-NEXT: store volatile double [[TMP9]], ptr [[BLOCK_CAPTURED]], align 8
579 // CHECK4-NEXT: [[BLOCK_CAPTURED2:%.*]] = getelementptr inbounds <{ ptr, i32, i32, ptr, ptr, double, i32 }>, ptr [[BLOCK]], i32 0, i32 6
580 // CHECK4-NEXT: [[TMP10:%.*]] = load i32, ptr [[SIVAR]], align 4
581 // CHECK4-NEXT: store i32 [[TMP10]], ptr [[BLOCK_CAPTURED2]], align 8
582 // CHECK4-NEXT: [[TMP11:%.*]] = getelementptr inbounds [[STRUCT___BLOCK_LITERAL_GENERIC:%.*]], ptr [[BLOCK]], i32 0, i32 3
583 // CHECK4-NEXT: [[TMP12:%.*]] = load ptr, ptr [[TMP11]], align 8
584 // CHECK4-NEXT: call void [[TMP12]](ptr noundef [[BLOCK]])
585 // CHECK4-NEXT: br label [[DOTOMP_SECTIONS_EXIT]]
586 // CHECK4: .omp.sections.exit:
587 // CHECK4-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
588 // CHECK4: omp.inner.for.inc:
589 // CHECK4-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
590 // CHECK4-NEXT: [[INC:%.*]] = add nsw i32 [[TMP13]], 1
591 // CHECK4-NEXT: store i32 [[INC]], ptr [[DOTOMP_SECTIONS_IV_]], align 4
592 // CHECK4-NEXT: br label [[OMP_INNER_FOR_COND]]
593 // CHECK4: omp.inner.for.end:
594 // CHECK4-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP1]])
595 // CHECK4-NEXT: call void @__kmpc_barrier(ptr @[[GLOB2:[0-9]+]], i32 [[TMP1]])
596 // CHECK4-NEXT: ret void
599 // CHECK4-LABEL: define {{[^@]+}}@_block_invoke
600 // CHECK4-SAME: (ptr noundef [[DOTBLOCK_DESCRIPTOR:%.*]]) #[[ATTR2]] {
601 // CHECK4-NEXT: entry:
602 // CHECK4-NEXT: [[DOTBLOCK_DESCRIPTOR_ADDR:%.*]] = alloca ptr, align 8
603 // CHECK4-NEXT: [[BLOCK_ADDR:%.*]] = alloca ptr, align 8
604 // CHECK4-NEXT: store ptr [[DOTBLOCK_DESCRIPTOR]], ptr [[DOTBLOCK_DESCRIPTOR_ADDR]], align 8
605 // CHECK4-NEXT: store ptr [[DOTBLOCK_DESCRIPTOR]], ptr [[BLOCK_ADDR]], align 8
606 // CHECK4-NEXT: [[BLOCK_CAPTURE_ADDR:%.*]] = getelementptr inbounds <{ ptr, i32, i32, ptr, ptr, double, i32 }>, ptr [[DOTBLOCK_DESCRIPTOR]], i32 0, i32 5
607 // CHECK4-NEXT: store double 2.000000e+00, ptr [[BLOCK_CAPTURE_ADDR]], align 8
608 // CHECK4-NEXT: [[BLOCK_CAPTURE_ADDR1:%.*]] = getelementptr inbounds <{ ptr, i32, i32, ptr, ptr, double, i32 }>, ptr [[DOTBLOCK_DESCRIPTOR]], i32 0, i32 6
609 // CHECK4-NEXT: store i32 222, ptr [[BLOCK_CAPTURE_ADDR1]], align 8
610 // CHECK4-NEXT: ret void