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 -DCHECK -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK1
3 // RUN: %clang_cc1 -DCHECK -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
4 // RUN: %clang_cc1 -DCHECK -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK1
5 // RUN: %clang_cc1 -DCHECK -verify -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK3
6 // RUN: %clang_cc1 -DCHECK -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -o %t %s
7 // RUN: %clang_cc1 -DCHECK -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK3
9 // RUN: %clang_cc1 -DCHECK -verify -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK5
10 // RUN: %clang_cc1 -DCHECK -fopenmp-simd -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
11 // RUN: %clang_cc1 -DCHECK -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK5
12 // RUN: %clang_cc1 -DCHECK -verify -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK7
13 // RUN: %clang_cc1 -DCHECK -fopenmp-simd -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -o %t %s
14 // RUN: %clang_cc1 -DCHECK -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK7
16 // RUN: %clang_cc1 -DLAMBDA -verify -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK9
17 // RUN: %clang_cc1 -DLAMBDA -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
18 // RUN: %clang_cc1 -DLAMBDA -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK9
20 // RUN: %clang_cc1 -DLAMBDA -verify -fopenmp-simd -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK11
21 // RUN: %clang_cc1 -DLAMBDA -fopenmp-simd -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
22 // RUN: %clang_cc1 -DLAMBDA -fopenmp-simd -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK11
24 // expected-no-diagnostics
33 #pragma omp teams distribute simd reduction(+: t_var)
34 for (int i
= 0; i
< 2; ++i
) {
46 #pragma omp teams distribute simd reduction(+: sivar)
47 for (int i
= 0; i
< 2; ++i
) {
49 // Skip global and bound tid vars
64 #pragma omp teams distribute simd reduction(+: sivar)
65 for (int i
= 0; i
< 2; ++i
) {
75 // Skip global and bound tid vars
81 // Skip global and bound tid vars
85 // CHECK1-LABEL: define {{[^@]+}}@main
86 // CHECK1-SAME: () #[[ATTR0:[0-9]+]] {
87 // CHECK1-NEXT: entry:
88 // CHECK1-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
89 // CHECK1-NEXT: [[SIVAR_CASTED:%.*]] = alloca i64, align 8
90 // CHECK1-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [1 x ptr], align 8
91 // CHECK1-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [1 x ptr], align 8
92 // CHECK1-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [1 x ptr], align 8
93 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
94 // CHECK1-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
95 // CHECK1-NEXT: store i32 0, ptr [[RETVAL]], align 4
96 // CHECK1-NEXT: [[TMP0:%.*]] = load i32, ptr @_ZZ4mainE5sivar, align 4
97 // CHECK1-NEXT: store i32 [[TMP0]], ptr [[SIVAR_CASTED]], align 4
98 // CHECK1-NEXT: [[TMP1:%.*]] = load i64, ptr [[SIVAR_CASTED]], align 8
99 // CHECK1-NEXT: [[TMP2:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
100 // CHECK1-NEXT: store i64 [[TMP1]], ptr [[TMP2]], align 8
101 // CHECK1-NEXT: [[TMP3:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
102 // CHECK1-NEXT: store i64 [[TMP1]], ptr [[TMP3]], align 8
103 // CHECK1-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 0
104 // CHECK1-NEXT: store ptr null, ptr [[TMP4]], align 8
105 // CHECK1-NEXT: [[TMP5:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
106 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
107 // CHECK1-NEXT: [[TMP7:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
108 // CHECK1-NEXT: store i32 2, ptr [[TMP7]], align 4
109 // CHECK1-NEXT: [[TMP8:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
110 // CHECK1-NEXT: store i32 1, ptr [[TMP8]], align 4
111 // CHECK1-NEXT: [[TMP9:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
112 // CHECK1-NEXT: store ptr [[TMP5]], ptr [[TMP9]], align 8
113 // CHECK1-NEXT: [[TMP10:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
114 // CHECK1-NEXT: store ptr [[TMP6]], ptr [[TMP10]], align 8
115 // CHECK1-NEXT: [[TMP11:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
116 // CHECK1-NEXT: store ptr @.offload_sizes, ptr [[TMP11]], align 8
117 // CHECK1-NEXT: [[TMP12:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
118 // CHECK1-NEXT: store ptr @.offload_maptypes, ptr [[TMP12]], align 8
119 // CHECK1-NEXT: [[TMP13:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
120 // CHECK1-NEXT: store ptr null, ptr [[TMP13]], align 8
121 // CHECK1-NEXT: [[TMP14:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
122 // CHECK1-NEXT: store ptr null, ptr [[TMP14]], align 8
123 // CHECK1-NEXT: [[TMP15:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
124 // CHECK1-NEXT: store i64 2, ptr [[TMP15]], align 8
125 // CHECK1-NEXT: [[TMP16:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
126 // CHECK1-NEXT: store i64 0, ptr [[TMP16]], align 8
127 // CHECK1-NEXT: [[TMP17:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
128 // CHECK1-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP17]], align 4
129 // CHECK1-NEXT: [[TMP18:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
130 // CHECK1-NEXT: store [3 x i32] [i32 1, i32 0, i32 0], ptr [[TMP18]], align 4
131 // CHECK1-NEXT: [[TMP19:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
132 // CHECK1-NEXT: store i32 0, ptr [[TMP19]], align 4
133 // CHECK1-NEXT: [[TMP20:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB3:[0-9]+]], i64 -1, i32 0, i32 1, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l63.region_id, ptr [[KERNEL_ARGS]])
134 // CHECK1-NEXT: [[TMP21:%.*]] = icmp ne i32 [[TMP20]], 0
135 // CHECK1-NEXT: br i1 [[TMP21]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
136 // CHECK1: omp_offload.failed:
137 // CHECK1-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l63(i64 [[TMP1]]) #[[ATTR3:[0-9]+]]
138 // CHECK1-NEXT: br label [[OMP_OFFLOAD_CONT]]
139 // CHECK1: omp_offload.cont:
140 // CHECK1-NEXT: [[CALL:%.*]] = call noundef signext i32 @_Z5tmainIiET_v()
141 // CHECK1-NEXT: ret i32 [[CALL]]
144 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l63
145 // CHECK1-SAME: (i64 noundef [[SIVAR:%.*]]) #[[ATTR1:[0-9]+]] {
146 // CHECK1-NEXT: entry:
147 // CHECK1-NEXT: [[SIVAR_ADDR:%.*]] = alloca i64, align 8
148 // CHECK1-NEXT: store i64 [[SIVAR]], ptr [[SIVAR_ADDR]], align 8
149 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB3]], i32 1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l63.omp_outlined, ptr [[SIVAR_ADDR]])
150 // CHECK1-NEXT: ret void
153 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l63.omp_outlined
154 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[SIVAR:%.*]]) #[[ATTR2:[0-9]+]] {
155 // CHECK1-NEXT: entry:
156 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
157 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
158 // CHECK1-NEXT: [[SIVAR_ADDR:%.*]] = alloca ptr, align 8
159 // CHECK1-NEXT: [[SIVAR1:%.*]] = alloca i32, align 4
160 // CHECK1-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
161 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
162 // CHECK1-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
163 // CHECK1-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
164 // CHECK1-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
165 // CHECK1-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
166 // CHECK1-NEXT: [[I:%.*]] = alloca i32, align 4
167 // CHECK1-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 8
168 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
169 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
170 // CHECK1-NEXT: store ptr [[SIVAR]], ptr [[SIVAR_ADDR]], align 8
171 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[SIVAR_ADDR]], align 8
172 // CHECK1-NEXT: store i32 0, ptr [[SIVAR1]], align 4
173 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
174 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_UB]], align 4
175 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
176 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
177 // CHECK1-NEXT: [[TMP1:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
178 // CHECK1-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP1]], align 4
179 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1:[0-9]+]], i32 [[TMP2]], i32 92, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_LB]], ptr [[DOTOMP_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
180 // CHECK1-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
181 // CHECK1-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP3]], 1
182 // CHECK1-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
183 // CHECK1: cond.true:
184 // CHECK1-NEXT: br label [[COND_END:%.*]]
185 // CHECK1: cond.false:
186 // CHECK1-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
187 // CHECK1-NEXT: br label [[COND_END]]
189 // CHECK1-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP4]], [[COND_FALSE]] ]
190 // CHECK1-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
191 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
192 // CHECK1-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_IV]], align 4
193 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
194 // CHECK1: omp.inner.for.cond:
195 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP5:![0-9]+]]
196 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4, !llvm.access.group [[ACC_GRP5]]
197 // CHECK1-NEXT: [[CMP2:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
198 // CHECK1-NEXT: br i1 [[CMP2]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
199 // CHECK1: omp.inner.for.body:
200 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP5]]
201 // CHECK1-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP8]], 1
202 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
203 // CHECK1-NEXT: store i32 [[ADD]], ptr [[I]], align 4, !llvm.access.group [[ACC_GRP5]]
204 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[I]], align 4, !llvm.access.group [[ACC_GRP5]]
205 // CHECK1-NEXT: [[TMP10:%.*]] = load i32, ptr [[SIVAR1]], align 4, !llvm.access.group [[ACC_GRP5]]
206 // CHECK1-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP10]], [[TMP9]]
207 // CHECK1-NEXT: store i32 [[ADD3]], ptr [[SIVAR1]], align 4, !llvm.access.group [[ACC_GRP5]]
208 // CHECK1-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
209 // CHECK1: omp.body.continue:
210 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
211 // CHECK1: omp.inner.for.inc:
212 // CHECK1-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP5]]
213 // CHECK1-NEXT: [[ADD4:%.*]] = add nsw i32 [[TMP11]], 1
214 // CHECK1-NEXT: store i32 [[ADD4]], ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP5]]
215 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]], !llvm.loop [[LOOP6:![0-9]+]]
216 // CHECK1: omp.inner.for.end:
217 // CHECK1-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
218 // CHECK1: omp.loop.exit:
219 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP2]])
220 // CHECK1-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_IS_LAST]], align 4
221 // CHECK1-NEXT: [[TMP13:%.*]] = icmp ne i32 [[TMP12]], 0
222 // CHECK1-NEXT: br i1 [[TMP13]], label [[DOTOMP_FINAL_THEN:%.*]], label [[DOTOMP_FINAL_DONE:%.*]]
223 // CHECK1: .omp.final.then:
224 // CHECK1-NEXT: store i32 2, ptr [[I]], align 4
225 // CHECK1-NEXT: br label [[DOTOMP_FINAL_DONE]]
226 // CHECK1: .omp.final.done:
227 // CHECK1-NEXT: [[TMP14:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i64 0, i64 0
228 // CHECK1-NEXT: store ptr [[SIVAR1]], ptr [[TMP14]], align 8
229 // CHECK1-NEXT: [[TMP15:%.*]] = call i32 @__kmpc_reduce(ptr @[[GLOB2:[0-9]+]], i32 [[TMP2]], i32 1, i64 8, ptr [[DOTOMP_REDUCTION_RED_LIST]], ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l63.omp_outlined.omp.reduction.reduction_func, ptr @.gomp_critical_user_.reduction.var)
230 // CHECK1-NEXT: switch i32 [[TMP15]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
231 // CHECK1-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
232 // CHECK1-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
234 // CHECK1: .omp.reduction.case1:
235 // CHECK1-NEXT: [[TMP16:%.*]] = load i32, ptr [[TMP0]], align 4
236 // CHECK1-NEXT: [[TMP17:%.*]] = load i32, ptr [[SIVAR1]], align 4
237 // CHECK1-NEXT: [[ADD5:%.*]] = add nsw i32 [[TMP16]], [[TMP17]]
238 // CHECK1-NEXT: store i32 [[ADD5]], ptr [[TMP0]], align 4
239 // CHECK1-NEXT: call void @__kmpc_end_reduce(ptr @[[GLOB2]], i32 [[TMP2]], ptr @.gomp_critical_user_.reduction.var)
240 // CHECK1-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
241 // CHECK1: .omp.reduction.case2:
242 // CHECK1-NEXT: [[TMP18:%.*]] = load i32, ptr [[SIVAR1]], align 4
243 // CHECK1-NEXT: [[TMP19:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP18]] monotonic, align 4
244 // CHECK1-NEXT: call void @__kmpc_end_reduce(ptr @[[GLOB2]], i32 [[TMP2]], ptr @.gomp_critical_user_.reduction.var)
245 // CHECK1-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
246 // CHECK1: .omp.reduction.default:
247 // CHECK1-NEXT: ret void
250 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l63.omp_outlined.omp.reduction.reduction_func
251 // CHECK1-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR4:[0-9]+]] {
252 // CHECK1-NEXT: entry:
253 // CHECK1-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 8
254 // CHECK1-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 8
255 // CHECK1-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 8
256 // CHECK1-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 8
257 // CHECK1-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 8
258 // CHECK1-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 8
259 // CHECK1-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i64 0, i64 0
260 // CHECK1-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 8
261 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i64 0, i64 0
262 // CHECK1-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 8
263 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
264 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
265 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
266 // CHECK1-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
267 // CHECK1-NEXT: ret void
270 // CHECK1-LABEL: define {{[^@]+}}@_Z5tmainIiET_v
271 // CHECK1-SAME: () #[[ATTR6:[0-9]+]] comdat {
272 // CHECK1-NEXT: entry:
273 // CHECK1-NEXT: [[T_VAR:%.*]] = alloca i32, align 4
274 // CHECK1-NEXT: [[VEC:%.*]] = alloca [2 x i32], align 4
275 // CHECK1-NEXT: [[T_VAR_CASTED:%.*]] = alloca i64, align 8
276 // CHECK1-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [1 x ptr], align 8
277 // CHECK1-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [1 x ptr], align 8
278 // CHECK1-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [1 x ptr], align 8
279 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
280 // CHECK1-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
281 // CHECK1-NEXT: store i32 0, ptr [[T_VAR]], align 4
282 // CHECK1-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[VEC]], ptr align 4 @__const._Z5tmainIiET_v.vec, i64 8, i1 false)
283 // CHECK1-NEXT: [[TMP0:%.*]] = load i32, ptr [[T_VAR]], align 4
284 // CHECK1-NEXT: store i32 [[TMP0]], ptr [[T_VAR_CASTED]], align 4
285 // CHECK1-NEXT: [[TMP1:%.*]] = load i64, ptr [[T_VAR_CASTED]], align 8
286 // CHECK1-NEXT: [[TMP2:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
287 // CHECK1-NEXT: store i64 [[TMP1]], ptr [[TMP2]], align 8
288 // CHECK1-NEXT: [[TMP3:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
289 // CHECK1-NEXT: store i64 [[TMP1]], ptr [[TMP3]], align 8
290 // CHECK1-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 0
291 // CHECK1-NEXT: store ptr null, ptr [[TMP4]], align 8
292 // CHECK1-NEXT: [[TMP5:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
293 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
294 // CHECK1-NEXT: [[TMP7:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
295 // CHECK1-NEXT: store i32 2, ptr [[TMP7]], align 4
296 // CHECK1-NEXT: [[TMP8:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
297 // CHECK1-NEXT: store i32 1, ptr [[TMP8]], align 4
298 // CHECK1-NEXT: [[TMP9:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
299 // CHECK1-NEXT: store ptr [[TMP5]], ptr [[TMP9]], align 8
300 // CHECK1-NEXT: [[TMP10:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
301 // CHECK1-NEXT: store ptr [[TMP6]], ptr [[TMP10]], align 8
302 // CHECK1-NEXT: [[TMP11:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
303 // CHECK1-NEXT: store ptr @.offload_sizes.1, ptr [[TMP11]], align 8
304 // CHECK1-NEXT: [[TMP12:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
305 // CHECK1-NEXT: store ptr @.offload_maptypes.2, ptr [[TMP12]], align 8
306 // CHECK1-NEXT: [[TMP13:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
307 // CHECK1-NEXT: store ptr null, ptr [[TMP13]], align 8
308 // CHECK1-NEXT: [[TMP14:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
309 // CHECK1-NEXT: store ptr null, ptr [[TMP14]], align 8
310 // CHECK1-NEXT: [[TMP15:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
311 // CHECK1-NEXT: store i64 2, ptr [[TMP15]], align 8
312 // CHECK1-NEXT: [[TMP16:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
313 // CHECK1-NEXT: store i64 0, ptr [[TMP16]], align 8
314 // CHECK1-NEXT: [[TMP17:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
315 // CHECK1-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP17]], align 4
316 // CHECK1-NEXT: [[TMP18:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
317 // CHECK1-NEXT: store [3 x i32] [i32 1, i32 0, i32 0], ptr [[TMP18]], align 4
318 // CHECK1-NEXT: [[TMP19:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
319 // CHECK1-NEXT: store i32 0, ptr [[TMP19]], align 4
320 // CHECK1-NEXT: [[TMP20:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB3]], i64 -1, i32 0, i32 1, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.region_id, ptr [[KERNEL_ARGS]])
321 // CHECK1-NEXT: [[TMP21:%.*]] = icmp ne i32 [[TMP20]], 0
322 // CHECK1-NEXT: br i1 [[TMP21]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
323 // CHECK1: omp_offload.failed:
324 // CHECK1-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32(i64 [[TMP1]]) #[[ATTR3]]
325 // CHECK1-NEXT: br label [[OMP_OFFLOAD_CONT]]
326 // CHECK1: omp_offload.cont:
327 // CHECK1-NEXT: ret i32 0
330 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32
331 // CHECK1-SAME: (i64 noundef [[T_VAR:%.*]]) #[[ATTR1]] {
332 // CHECK1-NEXT: entry:
333 // CHECK1-NEXT: [[T_VAR_ADDR:%.*]] = alloca i64, align 8
334 // CHECK1-NEXT: store i64 [[T_VAR]], ptr [[T_VAR_ADDR]], align 8
335 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB3]], i32 1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined, ptr [[T_VAR_ADDR]])
336 // CHECK1-NEXT: ret void
339 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined
340 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[T_VAR:%.*]]) #[[ATTR2]] {
341 // CHECK1-NEXT: entry:
342 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
343 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
344 // CHECK1-NEXT: [[T_VAR_ADDR:%.*]] = alloca ptr, align 8
345 // CHECK1-NEXT: [[T_VAR1:%.*]] = alloca i32, align 4
346 // CHECK1-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
347 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
348 // CHECK1-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
349 // CHECK1-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
350 // CHECK1-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
351 // CHECK1-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
352 // CHECK1-NEXT: [[I:%.*]] = alloca i32, align 4
353 // CHECK1-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 8
354 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
355 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
356 // CHECK1-NEXT: store ptr [[T_VAR]], ptr [[T_VAR_ADDR]], align 8
357 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[T_VAR_ADDR]], align 8
358 // CHECK1-NEXT: store i32 0, ptr [[T_VAR1]], align 4
359 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
360 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_UB]], align 4
361 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
362 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
363 // CHECK1-NEXT: [[TMP1:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
364 // CHECK1-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP1]], align 4
365 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1]], i32 [[TMP2]], i32 92, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_LB]], ptr [[DOTOMP_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
366 // CHECK1-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
367 // CHECK1-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP3]], 1
368 // CHECK1-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
369 // CHECK1: cond.true:
370 // CHECK1-NEXT: br label [[COND_END:%.*]]
371 // CHECK1: cond.false:
372 // CHECK1-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
373 // CHECK1-NEXT: br label [[COND_END]]
375 // CHECK1-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP4]], [[COND_FALSE]] ]
376 // CHECK1-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
377 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
378 // CHECK1-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_IV]], align 4
379 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
380 // CHECK1: omp.inner.for.cond:
381 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP11:![0-9]+]]
382 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4, !llvm.access.group [[ACC_GRP11]]
383 // CHECK1-NEXT: [[CMP2:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
384 // CHECK1-NEXT: br i1 [[CMP2]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
385 // CHECK1: omp.inner.for.body:
386 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP11]]
387 // CHECK1-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP8]], 1
388 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
389 // CHECK1-NEXT: store i32 [[ADD]], ptr [[I]], align 4, !llvm.access.group [[ACC_GRP11]]
390 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[I]], align 4, !llvm.access.group [[ACC_GRP11]]
391 // CHECK1-NEXT: [[TMP10:%.*]] = load i32, ptr [[T_VAR1]], align 4, !llvm.access.group [[ACC_GRP11]]
392 // CHECK1-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP10]], [[TMP9]]
393 // CHECK1-NEXT: store i32 [[ADD3]], ptr [[T_VAR1]], align 4, !llvm.access.group [[ACC_GRP11]]
394 // CHECK1-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
395 // CHECK1: omp.body.continue:
396 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
397 // CHECK1: omp.inner.for.inc:
398 // CHECK1-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP11]]
399 // CHECK1-NEXT: [[ADD4:%.*]] = add nsw i32 [[TMP11]], 1
400 // CHECK1-NEXT: store i32 [[ADD4]], ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP11]]
401 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]], !llvm.loop [[LOOP12:![0-9]+]]
402 // CHECK1: omp.inner.for.end:
403 // CHECK1-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
404 // CHECK1: omp.loop.exit:
405 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP2]])
406 // CHECK1-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_IS_LAST]], align 4
407 // CHECK1-NEXT: [[TMP13:%.*]] = icmp ne i32 [[TMP12]], 0
408 // CHECK1-NEXT: br i1 [[TMP13]], label [[DOTOMP_FINAL_THEN:%.*]], label [[DOTOMP_FINAL_DONE:%.*]]
409 // CHECK1: .omp.final.then:
410 // CHECK1-NEXT: store i32 2, ptr [[I]], align 4
411 // CHECK1-NEXT: br label [[DOTOMP_FINAL_DONE]]
412 // CHECK1: .omp.final.done:
413 // CHECK1-NEXT: [[TMP14:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i64 0, i64 0
414 // CHECK1-NEXT: store ptr [[T_VAR1]], ptr [[TMP14]], align 8
415 // CHECK1-NEXT: [[TMP15:%.*]] = call i32 @__kmpc_reduce(ptr @[[GLOB2]], i32 [[TMP2]], i32 1, i64 8, ptr [[DOTOMP_REDUCTION_RED_LIST]], ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined.omp.reduction.reduction_func, ptr @.gomp_critical_user_.reduction.var)
416 // CHECK1-NEXT: switch i32 [[TMP15]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
417 // CHECK1-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
418 // CHECK1-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
420 // CHECK1: .omp.reduction.case1:
421 // CHECK1-NEXT: [[TMP16:%.*]] = load i32, ptr [[TMP0]], align 4
422 // CHECK1-NEXT: [[TMP17:%.*]] = load i32, ptr [[T_VAR1]], align 4
423 // CHECK1-NEXT: [[ADD5:%.*]] = add nsw i32 [[TMP16]], [[TMP17]]
424 // CHECK1-NEXT: store i32 [[ADD5]], ptr [[TMP0]], align 4
425 // CHECK1-NEXT: call void @__kmpc_end_reduce(ptr @[[GLOB2]], i32 [[TMP2]], ptr @.gomp_critical_user_.reduction.var)
426 // CHECK1-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
427 // CHECK1: .omp.reduction.case2:
428 // CHECK1-NEXT: [[TMP18:%.*]] = load i32, ptr [[T_VAR1]], align 4
429 // CHECK1-NEXT: [[TMP19:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP18]] monotonic, align 4
430 // CHECK1-NEXT: call void @__kmpc_end_reduce(ptr @[[GLOB2]], i32 [[TMP2]], ptr @.gomp_critical_user_.reduction.var)
431 // CHECK1-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
432 // CHECK1: .omp.reduction.default:
433 // CHECK1-NEXT: ret void
436 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined.omp.reduction.reduction_func
437 // CHECK1-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR4]] {
438 // CHECK1-NEXT: entry:
439 // CHECK1-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 8
440 // CHECK1-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 8
441 // CHECK1-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 8
442 // CHECK1-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 8
443 // CHECK1-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 8
444 // CHECK1-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 8
445 // CHECK1-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i64 0, i64 0
446 // CHECK1-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 8
447 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i64 0, i64 0
448 // CHECK1-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 8
449 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
450 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
451 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
452 // CHECK1-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
453 // CHECK1-NEXT: ret void
456 // CHECK1-LABEL: define {{[^@]+}}@.omp_offloading.requires_reg
457 // CHECK1-SAME: () #[[ATTR8:[0-9]+]] {
458 // CHECK1-NEXT: entry:
459 // CHECK1-NEXT: call void @__tgt_register_requires(i64 1)
460 // CHECK1-NEXT: ret void
463 // CHECK3-LABEL: define {{[^@]+}}@main
464 // CHECK3-SAME: () #[[ATTR0:[0-9]+]] {
465 // CHECK3-NEXT: entry:
466 // CHECK3-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
467 // CHECK3-NEXT: [[SIVAR_CASTED:%.*]] = alloca i32, align 4
468 // CHECK3-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [1 x ptr], align 4
469 // CHECK3-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [1 x ptr], align 4
470 // CHECK3-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [1 x ptr], align 4
471 // CHECK3-NEXT: [[TMP:%.*]] = alloca i32, align 4
472 // CHECK3-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
473 // CHECK3-NEXT: store i32 0, ptr [[RETVAL]], align 4
474 // CHECK3-NEXT: [[TMP0:%.*]] = load i32, ptr @_ZZ4mainE5sivar, align 4
475 // CHECK3-NEXT: store i32 [[TMP0]], ptr [[SIVAR_CASTED]], align 4
476 // CHECK3-NEXT: [[TMP1:%.*]] = load i32, ptr [[SIVAR_CASTED]], align 4
477 // CHECK3-NEXT: [[TMP2:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
478 // CHECK3-NEXT: store i32 [[TMP1]], ptr [[TMP2]], align 4
479 // CHECK3-NEXT: [[TMP3:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
480 // CHECK3-NEXT: store i32 [[TMP1]], ptr [[TMP3]], align 4
481 // CHECK3-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i32 0, i32 0
482 // CHECK3-NEXT: store ptr null, ptr [[TMP4]], align 4
483 // CHECK3-NEXT: [[TMP5:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
484 // CHECK3-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
485 // CHECK3-NEXT: [[TMP7:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
486 // CHECK3-NEXT: store i32 2, ptr [[TMP7]], align 4
487 // CHECK3-NEXT: [[TMP8:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
488 // CHECK3-NEXT: store i32 1, ptr [[TMP8]], align 4
489 // CHECK3-NEXT: [[TMP9:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
490 // CHECK3-NEXT: store ptr [[TMP5]], ptr [[TMP9]], align 4
491 // CHECK3-NEXT: [[TMP10:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
492 // CHECK3-NEXT: store ptr [[TMP6]], ptr [[TMP10]], align 4
493 // CHECK3-NEXT: [[TMP11:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
494 // CHECK3-NEXT: store ptr @.offload_sizes, ptr [[TMP11]], align 4
495 // CHECK3-NEXT: [[TMP12:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
496 // CHECK3-NEXT: store ptr @.offload_maptypes, ptr [[TMP12]], align 4
497 // CHECK3-NEXT: [[TMP13:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
498 // CHECK3-NEXT: store ptr null, ptr [[TMP13]], align 4
499 // CHECK3-NEXT: [[TMP14:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
500 // CHECK3-NEXT: store ptr null, ptr [[TMP14]], align 4
501 // CHECK3-NEXT: [[TMP15:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
502 // CHECK3-NEXT: store i64 2, ptr [[TMP15]], align 8
503 // CHECK3-NEXT: [[TMP16:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
504 // CHECK3-NEXT: store i64 0, ptr [[TMP16]], align 8
505 // CHECK3-NEXT: [[TMP17:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
506 // CHECK3-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP17]], align 4
507 // CHECK3-NEXT: [[TMP18:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
508 // CHECK3-NEXT: store [3 x i32] [i32 1, i32 0, i32 0], ptr [[TMP18]], align 4
509 // CHECK3-NEXT: [[TMP19:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
510 // CHECK3-NEXT: store i32 0, ptr [[TMP19]], align 4
511 // CHECK3-NEXT: [[TMP20:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB3:[0-9]+]], i64 -1, i32 0, i32 1, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l63.region_id, ptr [[KERNEL_ARGS]])
512 // CHECK3-NEXT: [[TMP21:%.*]] = icmp ne i32 [[TMP20]], 0
513 // CHECK3-NEXT: br i1 [[TMP21]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
514 // CHECK3: omp_offload.failed:
515 // CHECK3-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l63(i32 [[TMP1]]) #[[ATTR3:[0-9]+]]
516 // CHECK3-NEXT: br label [[OMP_OFFLOAD_CONT]]
517 // CHECK3: omp_offload.cont:
518 // CHECK3-NEXT: [[CALL:%.*]] = call noundef i32 @_Z5tmainIiET_v()
519 // CHECK3-NEXT: ret i32 [[CALL]]
522 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l63
523 // CHECK3-SAME: (i32 noundef [[SIVAR:%.*]]) #[[ATTR1:[0-9]+]] {
524 // CHECK3-NEXT: entry:
525 // CHECK3-NEXT: [[SIVAR_ADDR:%.*]] = alloca i32, align 4
526 // CHECK3-NEXT: store i32 [[SIVAR]], ptr [[SIVAR_ADDR]], align 4
527 // CHECK3-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB3]], i32 1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l63.omp_outlined, ptr [[SIVAR_ADDR]])
528 // CHECK3-NEXT: ret void
531 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l63.omp_outlined
532 // CHECK3-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[SIVAR:%.*]]) #[[ATTR2:[0-9]+]] {
533 // CHECK3-NEXT: entry:
534 // CHECK3-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 4
535 // CHECK3-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 4
536 // CHECK3-NEXT: [[SIVAR_ADDR:%.*]] = alloca ptr, align 4
537 // CHECK3-NEXT: [[SIVAR1:%.*]] = alloca i32, align 4
538 // CHECK3-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
539 // CHECK3-NEXT: [[TMP:%.*]] = alloca i32, align 4
540 // CHECK3-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
541 // CHECK3-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
542 // CHECK3-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
543 // CHECK3-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
544 // CHECK3-NEXT: [[I:%.*]] = alloca i32, align 4
545 // CHECK3-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 4
546 // CHECK3-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 4
547 // CHECK3-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 4
548 // CHECK3-NEXT: store ptr [[SIVAR]], ptr [[SIVAR_ADDR]], align 4
549 // CHECK3-NEXT: [[TMP0:%.*]] = load ptr, ptr [[SIVAR_ADDR]], align 4
550 // CHECK3-NEXT: store i32 0, ptr [[SIVAR1]], align 4
551 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
552 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_UB]], align 4
553 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
554 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
555 // CHECK3-NEXT: [[TMP1:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 4
556 // CHECK3-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP1]], align 4
557 // CHECK3-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1:[0-9]+]], i32 [[TMP2]], i32 92, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_LB]], ptr [[DOTOMP_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
558 // CHECK3-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
559 // CHECK3-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP3]], 1
560 // CHECK3-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
561 // CHECK3: cond.true:
562 // CHECK3-NEXT: br label [[COND_END:%.*]]
563 // CHECK3: cond.false:
564 // CHECK3-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
565 // CHECK3-NEXT: br label [[COND_END]]
567 // CHECK3-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP4]], [[COND_FALSE]] ]
568 // CHECK3-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
569 // CHECK3-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
570 // CHECK3-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_IV]], align 4
571 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
572 // CHECK3: omp.inner.for.cond:
573 // CHECK3-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP6:![0-9]+]]
574 // CHECK3-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4, !llvm.access.group [[ACC_GRP6]]
575 // CHECK3-NEXT: [[CMP2:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
576 // CHECK3-NEXT: br i1 [[CMP2]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
577 // CHECK3: omp.inner.for.body:
578 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP6]]
579 // CHECK3-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP8]], 1
580 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
581 // CHECK3-NEXT: store i32 [[ADD]], ptr [[I]], align 4, !llvm.access.group [[ACC_GRP6]]
582 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[I]], align 4, !llvm.access.group [[ACC_GRP6]]
583 // CHECK3-NEXT: [[TMP10:%.*]] = load i32, ptr [[SIVAR1]], align 4, !llvm.access.group [[ACC_GRP6]]
584 // CHECK3-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP10]], [[TMP9]]
585 // CHECK3-NEXT: store i32 [[ADD3]], ptr [[SIVAR1]], align 4, !llvm.access.group [[ACC_GRP6]]
586 // CHECK3-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
587 // CHECK3: omp.body.continue:
588 // CHECK3-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
589 // CHECK3: omp.inner.for.inc:
590 // CHECK3-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP6]]
591 // CHECK3-NEXT: [[ADD4:%.*]] = add nsw i32 [[TMP11]], 1
592 // CHECK3-NEXT: store i32 [[ADD4]], ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP6]]
593 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND]], !llvm.loop [[LOOP7:![0-9]+]]
594 // CHECK3: omp.inner.for.end:
595 // CHECK3-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
596 // CHECK3: omp.loop.exit:
597 // CHECK3-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP2]])
598 // CHECK3-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_IS_LAST]], align 4
599 // CHECK3-NEXT: [[TMP13:%.*]] = icmp ne i32 [[TMP12]], 0
600 // CHECK3-NEXT: br i1 [[TMP13]], label [[DOTOMP_FINAL_THEN:%.*]], label [[DOTOMP_FINAL_DONE:%.*]]
601 // CHECK3: .omp.final.then:
602 // CHECK3-NEXT: store i32 2, ptr [[I]], align 4
603 // CHECK3-NEXT: br label [[DOTOMP_FINAL_DONE]]
604 // CHECK3: .omp.final.done:
605 // CHECK3-NEXT: [[TMP14:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i32 0, i32 0
606 // CHECK3-NEXT: store ptr [[SIVAR1]], ptr [[TMP14]], align 4
607 // CHECK3-NEXT: [[TMP15:%.*]] = call i32 @__kmpc_reduce(ptr @[[GLOB2:[0-9]+]], i32 [[TMP2]], i32 1, i32 4, ptr [[DOTOMP_REDUCTION_RED_LIST]], ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l63.omp_outlined.omp.reduction.reduction_func, ptr @.gomp_critical_user_.reduction.var)
608 // CHECK3-NEXT: switch i32 [[TMP15]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
609 // CHECK3-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
610 // CHECK3-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
612 // CHECK3: .omp.reduction.case1:
613 // CHECK3-NEXT: [[TMP16:%.*]] = load i32, ptr [[TMP0]], align 4
614 // CHECK3-NEXT: [[TMP17:%.*]] = load i32, ptr [[SIVAR1]], align 4
615 // CHECK3-NEXT: [[ADD5:%.*]] = add nsw i32 [[TMP16]], [[TMP17]]
616 // CHECK3-NEXT: store i32 [[ADD5]], ptr [[TMP0]], align 4
617 // CHECK3-NEXT: call void @__kmpc_end_reduce(ptr @[[GLOB2]], i32 [[TMP2]], ptr @.gomp_critical_user_.reduction.var)
618 // CHECK3-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
619 // CHECK3: .omp.reduction.case2:
620 // CHECK3-NEXT: [[TMP18:%.*]] = load i32, ptr [[SIVAR1]], align 4
621 // CHECK3-NEXT: [[TMP19:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP18]] monotonic, align 4
622 // CHECK3-NEXT: call void @__kmpc_end_reduce(ptr @[[GLOB2]], i32 [[TMP2]], ptr @.gomp_critical_user_.reduction.var)
623 // CHECK3-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
624 // CHECK3: .omp.reduction.default:
625 // CHECK3-NEXT: ret void
628 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l63.omp_outlined.omp.reduction.reduction_func
629 // CHECK3-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR4:[0-9]+]] {
630 // CHECK3-NEXT: entry:
631 // CHECK3-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 4
632 // CHECK3-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 4
633 // CHECK3-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 4
634 // CHECK3-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 4
635 // CHECK3-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 4
636 // CHECK3-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 4
637 // CHECK3-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i32 0, i32 0
638 // CHECK3-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 4
639 // CHECK3-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i32 0, i32 0
640 // CHECK3-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 4
641 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
642 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
643 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
644 // CHECK3-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
645 // CHECK3-NEXT: ret void
648 // CHECK3-LABEL: define {{[^@]+}}@_Z5tmainIiET_v
649 // CHECK3-SAME: () #[[ATTR6:[0-9]+]] comdat {
650 // CHECK3-NEXT: entry:
651 // CHECK3-NEXT: [[T_VAR:%.*]] = alloca i32, align 4
652 // CHECK3-NEXT: [[VEC:%.*]] = alloca [2 x i32], align 4
653 // CHECK3-NEXT: [[T_VAR_CASTED:%.*]] = alloca i32, align 4
654 // CHECK3-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [1 x ptr], align 4
655 // CHECK3-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [1 x ptr], align 4
656 // CHECK3-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [1 x ptr], align 4
657 // CHECK3-NEXT: [[TMP:%.*]] = alloca i32, align 4
658 // CHECK3-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
659 // CHECK3-NEXT: store i32 0, ptr [[T_VAR]], align 4
660 // CHECK3-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 4 [[VEC]], ptr align 4 @__const._Z5tmainIiET_v.vec, i32 8, i1 false)
661 // CHECK3-NEXT: [[TMP0:%.*]] = load i32, ptr [[T_VAR]], align 4
662 // CHECK3-NEXT: store i32 [[TMP0]], ptr [[T_VAR_CASTED]], align 4
663 // CHECK3-NEXT: [[TMP1:%.*]] = load i32, ptr [[T_VAR_CASTED]], align 4
664 // CHECK3-NEXT: [[TMP2:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
665 // CHECK3-NEXT: store i32 [[TMP1]], ptr [[TMP2]], align 4
666 // CHECK3-NEXT: [[TMP3:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
667 // CHECK3-NEXT: store i32 [[TMP1]], ptr [[TMP3]], align 4
668 // CHECK3-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i32 0, i32 0
669 // CHECK3-NEXT: store ptr null, ptr [[TMP4]], align 4
670 // CHECK3-NEXT: [[TMP5:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
671 // CHECK3-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
672 // CHECK3-NEXT: [[TMP7:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
673 // CHECK3-NEXT: store i32 2, ptr [[TMP7]], align 4
674 // CHECK3-NEXT: [[TMP8:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
675 // CHECK3-NEXT: store i32 1, ptr [[TMP8]], align 4
676 // CHECK3-NEXT: [[TMP9:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
677 // CHECK3-NEXT: store ptr [[TMP5]], ptr [[TMP9]], align 4
678 // CHECK3-NEXT: [[TMP10:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
679 // CHECK3-NEXT: store ptr [[TMP6]], ptr [[TMP10]], align 4
680 // CHECK3-NEXT: [[TMP11:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
681 // CHECK3-NEXT: store ptr @.offload_sizes.1, ptr [[TMP11]], align 4
682 // CHECK3-NEXT: [[TMP12:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
683 // CHECK3-NEXT: store ptr @.offload_maptypes.2, ptr [[TMP12]], align 4
684 // CHECK3-NEXT: [[TMP13:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
685 // CHECK3-NEXT: store ptr null, ptr [[TMP13]], align 4
686 // CHECK3-NEXT: [[TMP14:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
687 // CHECK3-NEXT: store ptr null, ptr [[TMP14]], align 4
688 // CHECK3-NEXT: [[TMP15:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
689 // CHECK3-NEXT: store i64 2, ptr [[TMP15]], align 8
690 // CHECK3-NEXT: [[TMP16:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
691 // CHECK3-NEXT: store i64 0, ptr [[TMP16]], align 8
692 // CHECK3-NEXT: [[TMP17:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
693 // CHECK3-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP17]], align 4
694 // CHECK3-NEXT: [[TMP18:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
695 // CHECK3-NEXT: store [3 x i32] [i32 1, i32 0, i32 0], ptr [[TMP18]], align 4
696 // CHECK3-NEXT: [[TMP19:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
697 // CHECK3-NEXT: store i32 0, ptr [[TMP19]], align 4
698 // CHECK3-NEXT: [[TMP20:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB3]], i64 -1, i32 0, i32 1, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.region_id, ptr [[KERNEL_ARGS]])
699 // CHECK3-NEXT: [[TMP21:%.*]] = icmp ne i32 [[TMP20]], 0
700 // CHECK3-NEXT: br i1 [[TMP21]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
701 // CHECK3: omp_offload.failed:
702 // CHECK3-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32(i32 [[TMP1]]) #[[ATTR3]]
703 // CHECK3-NEXT: br label [[OMP_OFFLOAD_CONT]]
704 // CHECK3: omp_offload.cont:
705 // CHECK3-NEXT: ret i32 0
708 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32
709 // CHECK3-SAME: (i32 noundef [[T_VAR:%.*]]) #[[ATTR1]] {
710 // CHECK3-NEXT: entry:
711 // CHECK3-NEXT: [[T_VAR_ADDR:%.*]] = alloca i32, align 4
712 // CHECK3-NEXT: store i32 [[T_VAR]], ptr [[T_VAR_ADDR]], align 4
713 // CHECK3-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB3]], i32 1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined, ptr [[T_VAR_ADDR]])
714 // CHECK3-NEXT: ret void
717 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined
718 // CHECK3-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[T_VAR:%.*]]) #[[ATTR2]] {
719 // CHECK3-NEXT: entry:
720 // CHECK3-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 4
721 // CHECK3-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 4
722 // CHECK3-NEXT: [[T_VAR_ADDR:%.*]] = alloca ptr, align 4
723 // CHECK3-NEXT: [[T_VAR1:%.*]] = alloca i32, align 4
724 // CHECK3-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
725 // CHECK3-NEXT: [[TMP:%.*]] = alloca i32, align 4
726 // CHECK3-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
727 // CHECK3-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
728 // CHECK3-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
729 // CHECK3-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
730 // CHECK3-NEXT: [[I:%.*]] = alloca i32, align 4
731 // CHECK3-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 4
732 // CHECK3-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 4
733 // CHECK3-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 4
734 // CHECK3-NEXT: store ptr [[T_VAR]], ptr [[T_VAR_ADDR]], align 4
735 // CHECK3-NEXT: [[TMP0:%.*]] = load ptr, ptr [[T_VAR_ADDR]], align 4
736 // CHECK3-NEXT: store i32 0, ptr [[T_VAR1]], align 4
737 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
738 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_UB]], align 4
739 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
740 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
741 // CHECK3-NEXT: [[TMP1:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 4
742 // CHECK3-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP1]], align 4
743 // CHECK3-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1]], i32 [[TMP2]], i32 92, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_LB]], ptr [[DOTOMP_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
744 // CHECK3-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
745 // CHECK3-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP3]], 1
746 // CHECK3-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
747 // CHECK3: cond.true:
748 // CHECK3-NEXT: br label [[COND_END:%.*]]
749 // CHECK3: cond.false:
750 // CHECK3-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
751 // CHECK3-NEXT: br label [[COND_END]]
753 // CHECK3-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP4]], [[COND_FALSE]] ]
754 // CHECK3-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
755 // CHECK3-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
756 // CHECK3-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_IV]], align 4
757 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
758 // CHECK3: omp.inner.for.cond:
759 // CHECK3-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP12:![0-9]+]]
760 // CHECK3-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4, !llvm.access.group [[ACC_GRP12]]
761 // CHECK3-NEXT: [[CMP2:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
762 // CHECK3-NEXT: br i1 [[CMP2]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
763 // CHECK3: omp.inner.for.body:
764 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP12]]
765 // CHECK3-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP8]], 1
766 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
767 // CHECK3-NEXT: store i32 [[ADD]], ptr [[I]], align 4, !llvm.access.group [[ACC_GRP12]]
768 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[I]], align 4, !llvm.access.group [[ACC_GRP12]]
769 // CHECK3-NEXT: [[TMP10:%.*]] = load i32, ptr [[T_VAR1]], align 4, !llvm.access.group [[ACC_GRP12]]
770 // CHECK3-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP10]], [[TMP9]]
771 // CHECK3-NEXT: store i32 [[ADD3]], ptr [[T_VAR1]], align 4, !llvm.access.group [[ACC_GRP12]]
772 // CHECK3-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
773 // CHECK3: omp.body.continue:
774 // CHECK3-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
775 // CHECK3: omp.inner.for.inc:
776 // CHECK3-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP12]]
777 // CHECK3-NEXT: [[ADD4:%.*]] = add nsw i32 [[TMP11]], 1
778 // CHECK3-NEXT: store i32 [[ADD4]], ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP12]]
779 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND]], !llvm.loop [[LOOP13:![0-9]+]]
780 // CHECK3: omp.inner.for.end:
781 // CHECK3-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
782 // CHECK3: omp.loop.exit:
783 // CHECK3-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP2]])
784 // CHECK3-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_IS_LAST]], align 4
785 // CHECK3-NEXT: [[TMP13:%.*]] = icmp ne i32 [[TMP12]], 0
786 // CHECK3-NEXT: br i1 [[TMP13]], label [[DOTOMP_FINAL_THEN:%.*]], label [[DOTOMP_FINAL_DONE:%.*]]
787 // CHECK3: .omp.final.then:
788 // CHECK3-NEXT: store i32 2, ptr [[I]], align 4
789 // CHECK3-NEXT: br label [[DOTOMP_FINAL_DONE]]
790 // CHECK3: .omp.final.done:
791 // CHECK3-NEXT: [[TMP14:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i32 0, i32 0
792 // CHECK3-NEXT: store ptr [[T_VAR1]], ptr [[TMP14]], align 4
793 // CHECK3-NEXT: [[TMP15:%.*]] = call i32 @__kmpc_reduce(ptr @[[GLOB2]], i32 [[TMP2]], i32 1, i32 4, ptr [[DOTOMP_REDUCTION_RED_LIST]], ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined.omp.reduction.reduction_func, ptr @.gomp_critical_user_.reduction.var)
794 // CHECK3-NEXT: switch i32 [[TMP15]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
795 // CHECK3-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
796 // CHECK3-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
798 // CHECK3: .omp.reduction.case1:
799 // CHECK3-NEXT: [[TMP16:%.*]] = load i32, ptr [[TMP0]], align 4
800 // CHECK3-NEXT: [[TMP17:%.*]] = load i32, ptr [[T_VAR1]], align 4
801 // CHECK3-NEXT: [[ADD5:%.*]] = add nsw i32 [[TMP16]], [[TMP17]]
802 // CHECK3-NEXT: store i32 [[ADD5]], ptr [[TMP0]], align 4
803 // CHECK3-NEXT: call void @__kmpc_end_reduce(ptr @[[GLOB2]], i32 [[TMP2]], ptr @.gomp_critical_user_.reduction.var)
804 // CHECK3-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
805 // CHECK3: .omp.reduction.case2:
806 // CHECK3-NEXT: [[TMP18:%.*]] = load i32, ptr [[T_VAR1]], align 4
807 // CHECK3-NEXT: [[TMP19:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP18]] monotonic, align 4
808 // CHECK3-NEXT: call void @__kmpc_end_reduce(ptr @[[GLOB2]], i32 [[TMP2]], ptr @.gomp_critical_user_.reduction.var)
809 // CHECK3-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
810 // CHECK3: .omp.reduction.default:
811 // CHECK3-NEXT: ret void
814 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined.omp.reduction.reduction_func
815 // CHECK3-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR4]] {
816 // CHECK3-NEXT: entry:
817 // CHECK3-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 4
818 // CHECK3-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 4
819 // CHECK3-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 4
820 // CHECK3-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 4
821 // CHECK3-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 4
822 // CHECK3-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 4
823 // CHECK3-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i32 0, i32 0
824 // CHECK3-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 4
825 // CHECK3-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i32 0, i32 0
826 // CHECK3-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 4
827 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
828 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
829 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
830 // CHECK3-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
831 // CHECK3-NEXT: ret void
834 // CHECK3-LABEL: define {{[^@]+}}@.omp_offloading.requires_reg
835 // CHECK3-SAME: () #[[ATTR8:[0-9]+]] {
836 // CHECK3-NEXT: entry:
837 // CHECK3-NEXT: call void @__tgt_register_requires(i64 1)
838 // CHECK3-NEXT: ret void
841 // CHECK5-LABEL: define {{[^@]+}}@main
842 // CHECK5-SAME: () #[[ATTR0:[0-9]+]] {
843 // CHECK5-NEXT: entry:
844 // CHECK5-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
845 // CHECK5-NEXT: [[TMP:%.*]] = alloca i32, align 4
846 // CHECK5-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
847 // CHECK5-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
848 // CHECK5-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
849 // CHECK5-NEXT: [[I:%.*]] = alloca i32, align 4
850 // CHECK5-NEXT: [[SIVAR:%.*]] = alloca i32, align 4
851 // CHECK5-NEXT: store i32 0, ptr [[RETVAL]], align 4
852 // CHECK5-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
853 // CHECK5-NEXT: store i32 1, ptr [[DOTOMP_UB]], align 4
854 // CHECK5-NEXT: [[TMP0:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
855 // CHECK5-NEXT: store i32 [[TMP0]], ptr [[DOTOMP_IV]], align 4
856 // CHECK5-NEXT: store i32 0, ptr [[SIVAR]], align 4
857 // CHECK5-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
858 // CHECK5: omp.inner.for.cond:
859 // CHECK5-NEXT: [[TMP1:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP2:![0-9]+]]
860 // CHECK5-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4, !llvm.access.group [[ACC_GRP2]]
861 // CHECK5-NEXT: [[CMP:%.*]] = icmp sle i32 [[TMP1]], [[TMP2]]
862 // CHECK5-NEXT: br i1 [[CMP]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
863 // CHECK5: omp.inner.for.body:
864 // CHECK5-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP2]]
865 // CHECK5-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP3]], 1
866 // CHECK5-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
867 // CHECK5-NEXT: store i32 [[ADD]], ptr [[I]], align 4, !llvm.access.group [[ACC_GRP2]]
868 // CHECK5-NEXT: [[TMP4:%.*]] = load i32, ptr [[I]], align 4, !llvm.access.group [[ACC_GRP2]]
869 // CHECK5-NEXT: [[TMP5:%.*]] = load i32, ptr [[SIVAR]], align 4, !llvm.access.group [[ACC_GRP2]]
870 // CHECK5-NEXT: [[ADD1:%.*]] = add nsw i32 [[TMP5]], [[TMP4]]
871 // CHECK5-NEXT: store i32 [[ADD1]], ptr [[SIVAR]], align 4, !llvm.access.group [[ACC_GRP2]]
872 // CHECK5-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
873 // CHECK5: omp.body.continue:
874 // CHECK5-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
875 // CHECK5: omp.inner.for.inc:
876 // CHECK5-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP2]]
877 // CHECK5-NEXT: [[ADD2:%.*]] = add nsw i32 [[TMP6]], 1
878 // CHECK5-NEXT: store i32 [[ADD2]], ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP2]]
879 // CHECK5-NEXT: br label [[OMP_INNER_FOR_COND]], !llvm.loop [[LOOP3:![0-9]+]]
880 // CHECK5: omp.inner.for.end:
881 // CHECK5-NEXT: store i32 2, ptr [[I]], align 4
882 // CHECK5-NEXT: [[TMP7:%.*]] = load i32, ptr @_ZZ4mainE5sivar, align 4
883 // CHECK5-NEXT: [[TMP8:%.*]] = load i32, ptr [[SIVAR]], align 4
884 // CHECK5-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP7]], [[TMP8]]
885 // CHECK5-NEXT: store i32 [[ADD3]], ptr @_ZZ4mainE5sivar, align 4
886 // CHECK5-NEXT: [[CALL:%.*]] = call noundef signext i32 @_Z5tmainIiET_v()
887 // CHECK5-NEXT: ret i32 [[CALL]]
890 // CHECK5-LABEL: define {{[^@]+}}@_Z5tmainIiET_v
891 // CHECK5-SAME: () #[[ATTR1:[0-9]+]] comdat {
892 // CHECK5-NEXT: entry:
893 // CHECK5-NEXT: [[T_VAR:%.*]] = alloca i32, align 4
894 // CHECK5-NEXT: [[VEC:%.*]] = alloca [2 x i32], align 4
895 // CHECK5-NEXT: [[TMP:%.*]] = alloca i32, align 4
896 // CHECK5-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
897 // CHECK5-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
898 // CHECK5-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
899 // CHECK5-NEXT: [[I:%.*]] = alloca i32, align 4
900 // CHECK5-NEXT: [[T_VAR1:%.*]] = alloca i32, align 4
901 // CHECK5-NEXT: store i32 0, ptr [[T_VAR]], align 4
902 // CHECK5-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[VEC]], ptr align 4 @__const._Z5tmainIiET_v.vec, i64 8, i1 false)
903 // CHECK5-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
904 // CHECK5-NEXT: store i32 1, ptr [[DOTOMP_UB]], align 4
905 // CHECK5-NEXT: [[TMP0:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
906 // CHECK5-NEXT: store i32 [[TMP0]], ptr [[DOTOMP_IV]], align 4
907 // CHECK5-NEXT: store i32 0, ptr [[T_VAR1]], align 4
908 // CHECK5-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
909 // CHECK5: omp.inner.for.cond:
910 // CHECK5-NEXT: [[TMP1:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP6:![0-9]+]]
911 // CHECK5-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4, !llvm.access.group [[ACC_GRP6]]
912 // CHECK5-NEXT: [[CMP:%.*]] = icmp sle i32 [[TMP1]], [[TMP2]]
913 // CHECK5-NEXT: br i1 [[CMP]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
914 // CHECK5: omp.inner.for.body:
915 // CHECK5-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP6]]
916 // CHECK5-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP3]], 1
917 // CHECK5-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
918 // CHECK5-NEXT: store i32 [[ADD]], ptr [[I]], align 4, !llvm.access.group [[ACC_GRP6]]
919 // CHECK5-NEXT: [[TMP4:%.*]] = load i32, ptr [[I]], align 4, !llvm.access.group [[ACC_GRP6]]
920 // CHECK5-NEXT: [[TMP5:%.*]] = load i32, ptr [[T_VAR1]], align 4, !llvm.access.group [[ACC_GRP6]]
921 // CHECK5-NEXT: [[ADD2:%.*]] = add nsw i32 [[TMP5]], [[TMP4]]
922 // CHECK5-NEXT: store i32 [[ADD2]], ptr [[T_VAR1]], align 4, !llvm.access.group [[ACC_GRP6]]
923 // CHECK5-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
924 // CHECK5: omp.body.continue:
925 // CHECK5-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
926 // CHECK5: omp.inner.for.inc:
927 // CHECK5-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP6]]
928 // CHECK5-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP6]], 1
929 // CHECK5-NEXT: store i32 [[ADD3]], ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP6]]
930 // CHECK5-NEXT: br label [[OMP_INNER_FOR_COND]], !llvm.loop [[LOOP7:![0-9]+]]
931 // CHECK5: omp.inner.for.end:
932 // CHECK5-NEXT: store i32 2, ptr [[I]], align 4
933 // CHECK5-NEXT: [[TMP7:%.*]] = load i32, ptr [[T_VAR]], align 4
934 // CHECK5-NEXT: [[TMP8:%.*]] = load i32, ptr [[T_VAR1]], align 4
935 // CHECK5-NEXT: [[ADD4:%.*]] = add nsw i32 [[TMP7]], [[TMP8]]
936 // CHECK5-NEXT: store i32 [[ADD4]], ptr [[T_VAR]], align 4
937 // CHECK5-NEXT: ret i32 0
940 // CHECK7-LABEL: define {{[^@]+}}@main
941 // CHECK7-SAME: () #[[ATTR0:[0-9]+]] {
942 // CHECK7-NEXT: entry:
943 // CHECK7-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
944 // CHECK7-NEXT: [[TMP:%.*]] = alloca i32, align 4
945 // CHECK7-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
946 // CHECK7-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
947 // CHECK7-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
948 // CHECK7-NEXT: [[I:%.*]] = alloca i32, align 4
949 // CHECK7-NEXT: [[SIVAR:%.*]] = alloca i32, align 4
950 // CHECK7-NEXT: store i32 0, ptr [[RETVAL]], align 4
951 // CHECK7-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
952 // CHECK7-NEXT: store i32 1, ptr [[DOTOMP_UB]], align 4
953 // CHECK7-NEXT: [[TMP0:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
954 // CHECK7-NEXT: store i32 [[TMP0]], ptr [[DOTOMP_IV]], align 4
955 // CHECK7-NEXT: store i32 0, ptr [[SIVAR]], align 4
956 // CHECK7-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
957 // CHECK7: omp.inner.for.cond:
958 // CHECK7-NEXT: [[TMP1:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP3:![0-9]+]]
959 // CHECK7-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4, !llvm.access.group [[ACC_GRP3]]
960 // CHECK7-NEXT: [[CMP:%.*]] = icmp sle i32 [[TMP1]], [[TMP2]]
961 // CHECK7-NEXT: br i1 [[CMP]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
962 // CHECK7: omp.inner.for.body:
963 // CHECK7-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP3]]
964 // CHECK7-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP3]], 1
965 // CHECK7-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
966 // CHECK7-NEXT: store i32 [[ADD]], ptr [[I]], align 4, !llvm.access.group [[ACC_GRP3]]
967 // CHECK7-NEXT: [[TMP4:%.*]] = load i32, ptr [[I]], align 4, !llvm.access.group [[ACC_GRP3]]
968 // CHECK7-NEXT: [[TMP5:%.*]] = load i32, ptr [[SIVAR]], align 4, !llvm.access.group [[ACC_GRP3]]
969 // CHECK7-NEXT: [[ADD1:%.*]] = add nsw i32 [[TMP5]], [[TMP4]]
970 // CHECK7-NEXT: store i32 [[ADD1]], ptr [[SIVAR]], align 4, !llvm.access.group [[ACC_GRP3]]
971 // CHECK7-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
972 // CHECK7: omp.body.continue:
973 // CHECK7-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
974 // CHECK7: omp.inner.for.inc:
975 // CHECK7-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP3]]
976 // CHECK7-NEXT: [[ADD2:%.*]] = add nsw i32 [[TMP6]], 1
977 // CHECK7-NEXT: store i32 [[ADD2]], ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP3]]
978 // CHECK7-NEXT: br label [[OMP_INNER_FOR_COND]], !llvm.loop [[LOOP4:![0-9]+]]
979 // CHECK7: omp.inner.for.end:
980 // CHECK7-NEXT: store i32 2, ptr [[I]], align 4
981 // CHECK7-NEXT: [[TMP7:%.*]] = load i32, ptr @_ZZ4mainE5sivar, align 4
982 // CHECK7-NEXT: [[TMP8:%.*]] = load i32, ptr [[SIVAR]], align 4
983 // CHECK7-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP7]], [[TMP8]]
984 // CHECK7-NEXT: store i32 [[ADD3]], ptr @_ZZ4mainE5sivar, align 4
985 // CHECK7-NEXT: [[CALL:%.*]] = call noundef i32 @_Z5tmainIiET_v()
986 // CHECK7-NEXT: ret i32 [[CALL]]
989 // CHECK7-LABEL: define {{[^@]+}}@_Z5tmainIiET_v
990 // CHECK7-SAME: () #[[ATTR1:[0-9]+]] comdat {
991 // CHECK7-NEXT: entry:
992 // CHECK7-NEXT: [[T_VAR:%.*]] = alloca i32, align 4
993 // CHECK7-NEXT: [[VEC:%.*]] = alloca [2 x i32], align 4
994 // CHECK7-NEXT: [[TMP:%.*]] = alloca i32, align 4
995 // CHECK7-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
996 // CHECK7-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
997 // CHECK7-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
998 // CHECK7-NEXT: [[I:%.*]] = alloca i32, align 4
999 // CHECK7-NEXT: [[T_VAR1:%.*]] = alloca i32, align 4
1000 // CHECK7-NEXT: store i32 0, ptr [[T_VAR]], align 4
1001 // CHECK7-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 4 [[VEC]], ptr align 4 @__const._Z5tmainIiET_v.vec, i32 8, i1 false)
1002 // CHECK7-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
1003 // CHECK7-NEXT: store i32 1, ptr [[DOTOMP_UB]], align 4
1004 // CHECK7-NEXT: [[TMP0:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
1005 // CHECK7-NEXT: store i32 [[TMP0]], ptr [[DOTOMP_IV]], align 4
1006 // CHECK7-NEXT: store i32 0, ptr [[T_VAR1]], align 4
1007 // CHECK7-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
1008 // CHECK7: omp.inner.for.cond:
1009 // CHECK7-NEXT: [[TMP1:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP7:![0-9]+]]
1010 // CHECK7-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4, !llvm.access.group [[ACC_GRP7]]
1011 // CHECK7-NEXT: [[CMP:%.*]] = icmp sle i32 [[TMP1]], [[TMP2]]
1012 // CHECK7-NEXT: br i1 [[CMP]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
1013 // CHECK7: omp.inner.for.body:
1014 // CHECK7-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP7]]
1015 // CHECK7-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP3]], 1
1016 // CHECK7-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
1017 // CHECK7-NEXT: store i32 [[ADD]], ptr [[I]], align 4, !llvm.access.group [[ACC_GRP7]]
1018 // CHECK7-NEXT: [[TMP4:%.*]] = load i32, ptr [[I]], align 4, !llvm.access.group [[ACC_GRP7]]
1019 // CHECK7-NEXT: [[TMP5:%.*]] = load i32, ptr [[T_VAR1]], align 4, !llvm.access.group [[ACC_GRP7]]
1020 // CHECK7-NEXT: [[ADD2:%.*]] = add nsw i32 [[TMP5]], [[TMP4]]
1021 // CHECK7-NEXT: store i32 [[ADD2]], ptr [[T_VAR1]], align 4, !llvm.access.group [[ACC_GRP7]]
1022 // CHECK7-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
1023 // CHECK7: omp.body.continue:
1024 // CHECK7-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
1025 // CHECK7: omp.inner.for.inc:
1026 // CHECK7-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP7]]
1027 // CHECK7-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP6]], 1
1028 // CHECK7-NEXT: store i32 [[ADD3]], ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP7]]
1029 // CHECK7-NEXT: br label [[OMP_INNER_FOR_COND]], !llvm.loop [[LOOP8:![0-9]+]]
1030 // CHECK7: omp.inner.for.end:
1031 // CHECK7-NEXT: store i32 2, ptr [[I]], align 4
1032 // CHECK7-NEXT: [[TMP7:%.*]] = load i32, ptr [[T_VAR]], align 4
1033 // CHECK7-NEXT: [[TMP8:%.*]] = load i32, ptr [[T_VAR1]], align 4
1034 // CHECK7-NEXT: [[ADD4:%.*]] = add nsw i32 [[TMP7]], [[TMP8]]
1035 // CHECK7-NEXT: store i32 [[ADD4]], ptr [[T_VAR]], align 4
1036 // CHECK7-NEXT: ret i32 0
1039 // CHECK9-LABEL: define {{[^@]+}}@main
1040 // CHECK9-SAME: () #[[ATTR0:[0-9]+]] {
1041 // CHECK9-NEXT: entry:
1042 // CHECK9-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
1043 // CHECK9-NEXT: [[REF_TMP:%.*]] = alloca [[CLASS_ANON:%.*]], align 1
1044 // CHECK9-NEXT: store i32 0, ptr [[RETVAL]], align 4
1045 // CHECK9-NEXT: call void @"_ZZ4mainENK3$_0clEv"(ptr noundef nonnull align 1 dereferenceable(1) [[REF_TMP]])
1046 // CHECK9-NEXT: ret i32 0
1049 // CHECK9-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l45
1050 // CHECK9-SAME: (i64 noundef [[SIVAR:%.*]]) #[[ATTR2:[0-9]+]] {
1051 // CHECK9-NEXT: entry:
1052 // CHECK9-NEXT: [[SIVAR_ADDR:%.*]] = alloca i64, align 8
1053 // CHECK9-NEXT: store i64 [[SIVAR]], ptr [[SIVAR_ADDR]], align 8
1054 // CHECK9-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB3:[0-9]+]], i32 1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l45.omp_outlined, ptr [[SIVAR_ADDR]])
1055 // CHECK9-NEXT: ret void
1058 // CHECK9-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l45.omp_outlined
1059 // CHECK9-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[SIVAR:%.*]]) #[[ATTR3:[0-9]+]] {
1060 // CHECK9-NEXT: entry:
1061 // CHECK9-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
1062 // CHECK9-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
1063 // CHECK9-NEXT: [[SIVAR_ADDR:%.*]] = alloca ptr, align 8
1064 // CHECK9-NEXT: [[SIVAR1:%.*]] = alloca i32, align 4
1065 // CHECK9-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
1066 // CHECK9-NEXT: [[TMP:%.*]] = alloca i32, align 4
1067 // CHECK9-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
1068 // CHECK9-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
1069 // CHECK9-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
1070 // CHECK9-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
1071 // CHECK9-NEXT: [[I:%.*]] = alloca i32, align 4
1072 // CHECK9-NEXT: [[REF_TMP:%.*]] = alloca [[CLASS_ANON_0:%.*]], align 8
1073 // CHECK9-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 8
1074 // CHECK9-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
1075 // CHECK9-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
1076 // CHECK9-NEXT: store ptr [[SIVAR]], ptr [[SIVAR_ADDR]], align 8
1077 // CHECK9-NEXT: [[TMP0:%.*]] = load ptr, ptr [[SIVAR_ADDR]], align 8
1078 // CHECK9-NEXT: store i32 0, ptr [[SIVAR1]], align 4
1079 // CHECK9-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
1080 // CHECK9-NEXT: store i32 1, ptr [[DOTOMP_UB]], align 4
1081 // CHECK9-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
1082 // CHECK9-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
1083 // CHECK9-NEXT: [[TMP1:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
1084 // CHECK9-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP1]], align 4
1085 // CHECK9-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1:[0-9]+]], i32 [[TMP2]], i32 92, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_LB]], ptr [[DOTOMP_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
1086 // CHECK9-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
1087 // CHECK9-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP3]], 1
1088 // CHECK9-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
1089 // CHECK9: cond.true:
1090 // CHECK9-NEXT: br label [[COND_END:%.*]]
1091 // CHECK9: cond.false:
1092 // CHECK9-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
1093 // CHECK9-NEXT: br label [[COND_END]]
1094 // CHECK9: cond.end:
1095 // CHECK9-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP4]], [[COND_FALSE]] ]
1096 // CHECK9-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
1097 // CHECK9-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
1098 // CHECK9-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_IV]], align 4
1099 // CHECK9-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
1100 // CHECK9: omp.inner.for.cond:
1101 // CHECK9-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP4:![0-9]+]]
1102 // CHECK9-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4, !llvm.access.group [[ACC_GRP4]]
1103 // CHECK9-NEXT: [[CMP2:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
1104 // CHECK9-NEXT: br i1 [[CMP2]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
1105 // CHECK9: omp.inner.for.body:
1106 // CHECK9-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP4]]
1107 // CHECK9-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP8]], 1
1108 // CHECK9-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
1109 // CHECK9-NEXT: store i32 [[ADD]], ptr [[I]], align 4, !llvm.access.group [[ACC_GRP4]]
1110 // CHECK9-NEXT: [[TMP9:%.*]] = load i32, ptr [[I]], align 4, !llvm.access.group [[ACC_GRP4]]
1111 // CHECK9-NEXT: [[TMP10:%.*]] = load i32, ptr [[SIVAR1]], align 4, !llvm.access.group [[ACC_GRP4]]
1112 // CHECK9-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP10]], [[TMP9]]
1113 // CHECK9-NEXT: store i32 [[ADD3]], ptr [[SIVAR1]], align 4, !llvm.access.group [[ACC_GRP4]]
1114 // CHECK9-NEXT: [[TMP11:%.*]] = getelementptr inbounds [[CLASS_ANON_0]], ptr [[REF_TMP]], i32 0, i32 0
1115 // CHECK9-NEXT: store ptr [[SIVAR1]], ptr [[TMP11]], align 8, !llvm.access.group [[ACC_GRP4]]
1116 // CHECK9-NEXT: call void @"_ZZZ4mainENK3$_0clEvENKUlvE_clEv"(ptr noundef nonnull align 8 dereferenceable(8) [[REF_TMP]]), !llvm.access.group [[ACC_GRP4]]
1117 // CHECK9-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
1118 // CHECK9: omp.body.continue:
1119 // CHECK9-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
1120 // CHECK9: omp.inner.for.inc:
1121 // CHECK9-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP4]]
1122 // CHECK9-NEXT: [[ADD4:%.*]] = add nsw i32 [[TMP12]], 1
1123 // CHECK9-NEXT: store i32 [[ADD4]], ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP4]]
1124 // CHECK9-NEXT: br label [[OMP_INNER_FOR_COND]], !llvm.loop [[LOOP5:![0-9]+]]
1125 // CHECK9: omp.inner.for.end:
1126 // CHECK9-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
1127 // CHECK9: omp.loop.exit:
1128 // CHECK9-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP2]])
1129 // CHECK9-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_IS_LAST]], align 4
1130 // CHECK9-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
1131 // CHECK9-NEXT: br i1 [[TMP14]], label [[DOTOMP_FINAL_THEN:%.*]], label [[DOTOMP_FINAL_DONE:%.*]]
1132 // CHECK9: .omp.final.then:
1133 // CHECK9-NEXT: store i32 2, ptr [[I]], align 4
1134 // CHECK9-NEXT: br label [[DOTOMP_FINAL_DONE]]
1135 // CHECK9: .omp.final.done:
1136 // CHECK9-NEXT: [[TMP15:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i64 0, i64 0
1137 // CHECK9-NEXT: store ptr [[SIVAR1]], ptr [[TMP15]], align 8
1138 // CHECK9-NEXT: [[TMP16:%.*]] = call i32 @__kmpc_reduce(ptr @[[GLOB2:[0-9]+]], i32 [[TMP2]], i32 1, i64 8, ptr [[DOTOMP_REDUCTION_RED_LIST]], ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l45.omp_outlined.omp.reduction.reduction_func, ptr @.gomp_critical_user_.reduction.var)
1139 // CHECK9-NEXT: switch i32 [[TMP16]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
1140 // CHECK9-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
1141 // CHECK9-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
1143 // CHECK9: .omp.reduction.case1:
1144 // CHECK9-NEXT: [[TMP17:%.*]] = load i32, ptr [[TMP0]], align 4
1145 // CHECK9-NEXT: [[TMP18:%.*]] = load i32, ptr [[SIVAR1]], align 4
1146 // CHECK9-NEXT: [[ADD5:%.*]] = add nsw i32 [[TMP17]], [[TMP18]]
1147 // CHECK9-NEXT: store i32 [[ADD5]], ptr [[TMP0]], align 4
1148 // CHECK9-NEXT: call void @__kmpc_end_reduce(ptr @[[GLOB2]], i32 [[TMP2]], ptr @.gomp_critical_user_.reduction.var)
1149 // CHECK9-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
1150 // CHECK9: .omp.reduction.case2:
1151 // CHECK9-NEXT: [[TMP19:%.*]] = load i32, ptr [[SIVAR1]], align 4
1152 // CHECK9-NEXT: [[TMP20:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP19]] monotonic, align 4
1153 // CHECK9-NEXT: call void @__kmpc_end_reduce(ptr @[[GLOB2]], i32 [[TMP2]], ptr @.gomp_critical_user_.reduction.var)
1154 // CHECK9-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
1155 // CHECK9: .omp.reduction.default:
1156 // CHECK9-NEXT: ret void
1159 // CHECK9-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l45.omp_outlined.omp.reduction.reduction_func
1160 // CHECK9-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR5:[0-9]+]] {
1161 // CHECK9-NEXT: entry:
1162 // CHECK9-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 8
1163 // CHECK9-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 8
1164 // CHECK9-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 8
1165 // CHECK9-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 8
1166 // CHECK9-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 8
1167 // CHECK9-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 8
1168 // CHECK9-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i64 0, i64 0
1169 // CHECK9-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 8
1170 // CHECK9-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i64 0, i64 0
1171 // CHECK9-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 8
1172 // CHECK9-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
1173 // CHECK9-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
1174 // CHECK9-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
1175 // CHECK9-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
1176 // CHECK9-NEXT: ret void
1179 // CHECK9-LABEL: define {{[^@]+}}@.omp_offloading.requires_reg
1180 // CHECK9-SAME: () #[[ATTR7:[0-9]+]] {
1181 // CHECK9-NEXT: entry:
1182 // CHECK9-NEXT: call void @__tgt_register_requires(i64 1)
1183 // CHECK9-NEXT: ret void
1186 // CHECK11-LABEL: define {{[^@]+}}@main
1187 // CHECK11-SAME: () #[[ATTR0:[0-9]+]] {
1188 // CHECK11-NEXT: entry:
1189 // CHECK11-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
1190 // CHECK11-NEXT: [[REF_TMP:%.*]] = alloca [[CLASS_ANON:%.*]], align 1
1191 // CHECK11-NEXT: store i32 0, ptr [[RETVAL]], align 4
1192 // CHECK11-NEXT: call void @"_ZZ4mainENK3$_0clEv"(ptr noundef nonnull align 1 dereferenceable(1) [[REF_TMP]])
1193 // CHECK11-NEXT: ret i32 0