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 -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=CHECK5
10 // 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
11 // 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=CHECK5
13 // 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 --implicit-check-not="{{__kmpc|__tgt}}"
14 // 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
15 // 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 --implicit-check-not="{{__kmpc|__tgt}}"
16 // 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 --implicit-check-not="{{__kmpc|__tgt}}"
17 // 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
18 // 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 --implicit-check-not="{{__kmpc|__tgt}}"
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 --implicit-check-not="{{__kmpc|__tgt}}"
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 --implicit-check-not="{{__kmpc|__tgt}}"
24 // expected-no-diagnostics
32 #pragma omp target teams distribute parallel for reduction(+: t_var)
33 for (int i
= 0; i
< 2; ++i
) {
44 #pragma omp target teams distribute parallel for reduction(+: sivar)
45 for (int i
= 0; i
< 2; ++i
) {
47 // Skip global and bound tid vars
51 // Skip global and bound tid vars, and prev lb and ub vars
66 #pragma omp target teams distribute parallel for reduction(+: sivar)
67 for (int i
= 0; i
< 2; ++i
) {
77 // Skip global and bound tid vars
80 // Skip global and bound tid vars, and prev lb and ub
86 // Skip global and bound tid vars
89 // Skip global and bound tid vars, and prev lb and ub vars
93 // CHECK1-LABEL: define {{[^@]+}}@main
94 // CHECK1-SAME: () #[[ATTR0:[0-9]+]] {
95 // CHECK1-NEXT: entry:
96 // CHECK1-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
97 // CHECK1-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [1 x ptr], align 8
98 // CHECK1-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [1 x ptr], align 8
99 // CHECK1-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [1 x ptr], align 8
100 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
101 // CHECK1-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
102 // CHECK1-NEXT: store i32 0, ptr [[RETVAL]], align 4
103 // CHECK1-NEXT: [[TMP0:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
104 // CHECK1-NEXT: store ptr @_ZZ4mainE5sivar, ptr [[TMP0]], align 8
105 // CHECK1-NEXT: [[TMP1:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
106 // CHECK1-NEXT: store ptr @_ZZ4mainE5sivar, ptr [[TMP1]], align 8
107 // CHECK1-NEXT: [[TMP2:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 0
108 // CHECK1-NEXT: store ptr null, ptr [[TMP2]], align 8
109 // CHECK1-NEXT: [[TMP3:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
110 // CHECK1-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
111 // CHECK1-NEXT: [[TMP5:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
112 // CHECK1-NEXT: store i32 2, ptr [[TMP5]], align 4
113 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
114 // CHECK1-NEXT: store i32 1, ptr [[TMP6]], align 4
115 // CHECK1-NEXT: [[TMP7:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
116 // CHECK1-NEXT: store ptr [[TMP3]], ptr [[TMP7]], align 8
117 // CHECK1-NEXT: [[TMP8:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
118 // CHECK1-NEXT: store ptr [[TMP4]], ptr [[TMP8]], align 8
119 // CHECK1-NEXT: [[TMP9:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
120 // CHECK1-NEXT: store ptr @.offload_sizes, ptr [[TMP9]], align 8
121 // CHECK1-NEXT: [[TMP10:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
122 // CHECK1-NEXT: store ptr @.offload_maptypes, ptr [[TMP10]], align 8
123 // CHECK1-NEXT: [[TMP11:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
124 // CHECK1-NEXT: store ptr null, ptr [[TMP11]], align 8
125 // CHECK1-NEXT: [[TMP12:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
126 // CHECK1-NEXT: store ptr null, ptr [[TMP12]], align 8
127 // CHECK1-NEXT: [[TMP13:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
128 // CHECK1-NEXT: store i64 2, ptr [[TMP13]], align 8
129 // CHECK1-NEXT: [[TMP14:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
130 // CHECK1-NEXT: store i64 0, ptr [[TMP14]], align 8
131 // CHECK1-NEXT: [[TMP15:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
132 // CHECK1-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP15]], align 4
133 // CHECK1-NEXT: [[TMP16:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
134 // CHECK1-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP16]], align 4
135 // CHECK1-NEXT: [[TMP17:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
136 // CHECK1-NEXT: store i32 0, ptr [[TMP17]], align 4
137 // CHECK1-NEXT: [[TMP18:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB4:[0-9]+]], i64 -1, i32 0, i32 0, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l66.region_id, ptr [[KERNEL_ARGS]])
138 // CHECK1-NEXT: [[TMP19:%.*]] = icmp ne i32 [[TMP18]], 0
139 // CHECK1-NEXT: br i1 [[TMP19]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
140 // CHECK1: omp_offload.failed:
141 // CHECK1-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l66(ptr @_ZZ4mainE5sivar) #[[ATTR2:[0-9]+]]
142 // CHECK1-NEXT: br label [[OMP_OFFLOAD_CONT]]
143 // CHECK1: omp_offload.cont:
144 // CHECK1-NEXT: [[CALL:%.*]] = call noundef signext i32 @_Z5tmainIiET_v()
145 // CHECK1-NEXT: ret i32 [[CALL]]
148 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l66
149 // CHECK1-SAME: (ptr noundef nonnull align 4 dereferenceable(4) [[SIVAR:%.*]]) #[[ATTR1:[0-9]+]] {
150 // CHECK1-NEXT: entry:
151 // CHECK1-NEXT: [[SIVAR_ADDR:%.*]] = alloca ptr, align 8
152 // CHECK1-NEXT: store ptr [[SIVAR]], ptr [[SIVAR_ADDR]], align 8
153 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[SIVAR_ADDR]], align 8
154 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB4]], i32 1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l66.omp_outlined, ptr [[TMP0]])
155 // CHECK1-NEXT: ret void
158 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l66.omp_outlined
159 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[SIVAR:%.*]]) #[[ATTR1]] {
160 // CHECK1-NEXT: entry:
161 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
162 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
163 // CHECK1-NEXT: [[SIVAR_ADDR:%.*]] = alloca ptr, align 8
164 // CHECK1-NEXT: [[SIVAR1:%.*]] = alloca i32, align 4
165 // CHECK1-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
166 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
167 // CHECK1-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
168 // CHECK1-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
169 // CHECK1-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
170 // CHECK1-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
171 // CHECK1-NEXT: [[I:%.*]] = alloca i32, align 4
172 // CHECK1-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 8
173 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
174 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
175 // CHECK1-NEXT: store ptr [[SIVAR]], ptr [[SIVAR_ADDR]], align 8
176 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[SIVAR_ADDR]], align 8
177 // CHECK1-NEXT: store i32 0, ptr [[SIVAR1]], align 4
178 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
179 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_COMB_UB]], align 4
180 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
181 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
182 // CHECK1-NEXT: [[TMP1:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
183 // CHECK1-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP1]], align 4
184 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1:[0-9]+]], i32 [[TMP2]], i32 92, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_COMB_LB]], ptr [[DOTOMP_COMB_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
185 // CHECK1-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
186 // CHECK1-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP3]], 1
187 // CHECK1-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
188 // CHECK1: cond.true:
189 // CHECK1-NEXT: br label [[COND_END:%.*]]
190 // CHECK1: cond.false:
191 // CHECK1-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
192 // CHECK1-NEXT: br label [[COND_END]]
194 // CHECK1-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP4]], [[COND_FALSE]] ]
195 // CHECK1-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
196 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
197 // CHECK1-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_IV]], align 4
198 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
199 // CHECK1: omp.inner.for.cond:
200 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
201 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
202 // CHECK1-NEXT: [[CMP2:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
203 // CHECK1-NEXT: br i1 [[CMP2]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
204 // CHECK1: omp.inner.for.body:
205 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
206 // CHECK1-NEXT: [[TMP9:%.*]] = zext i32 [[TMP8]] to i64
207 // CHECK1-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
208 // CHECK1-NEXT: [[TMP11:%.*]] = zext i32 [[TMP10]] to i64
209 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB4]], i32 3, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l66.omp_outlined.omp_outlined, i64 [[TMP9]], i64 [[TMP11]], ptr [[SIVAR1]])
210 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
211 // CHECK1: omp.inner.for.inc:
212 // CHECK1-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
213 // CHECK1-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_STRIDE]], align 4
214 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP12]], [[TMP13]]
215 // CHECK1-NEXT: store i32 [[ADD]], ptr [[DOTOMP_IV]], align 4
216 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]]
217 // CHECK1: omp.inner.for.end:
218 // CHECK1-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
219 // CHECK1: omp.loop.exit:
220 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP2]])
221 // CHECK1-NEXT: [[TMP14:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i64 0, i64 0
222 // CHECK1-NEXT: store ptr [[SIVAR1]], ptr [[TMP14]], align 8
223 // CHECK1-NEXT: [[TMP15:%.*]] = call i32 @__kmpc_reduce_nowait(ptr @[[GLOB3:[0-9]+]], i32 [[TMP2]], i32 1, i64 8, ptr [[DOTOMP_REDUCTION_RED_LIST]], ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l66.omp_outlined.omp.reduction.reduction_func, ptr @.gomp_critical_user_.reduction.var)
224 // CHECK1-NEXT: switch i32 [[TMP15]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
225 // CHECK1-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
226 // CHECK1-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
228 // CHECK1: .omp.reduction.case1:
229 // CHECK1-NEXT: [[TMP16:%.*]] = load i32, ptr [[TMP0]], align 4
230 // CHECK1-NEXT: [[TMP17:%.*]] = load i32, ptr [[SIVAR1]], align 4
231 // CHECK1-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP16]], [[TMP17]]
232 // CHECK1-NEXT: store i32 [[ADD3]], ptr [[TMP0]], align 4
233 // CHECK1-NEXT: call void @__kmpc_end_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP2]], ptr @.gomp_critical_user_.reduction.var)
234 // CHECK1-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
235 // CHECK1: .omp.reduction.case2:
236 // CHECK1-NEXT: [[TMP18:%.*]] = load i32, ptr [[SIVAR1]], align 4
237 // CHECK1-NEXT: [[TMP19:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP18]] monotonic, align 4
238 // CHECK1-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
239 // CHECK1: .omp.reduction.default:
240 // CHECK1-NEXT: ret void
243 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l66.omp_outlined.omp_outlined
244 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], i64 noundef [[DOTPREVIOUS_LB_:%.*]], i64 noundef [[DOTPREVIOUS_UB_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[SIVAR:%.*]]) #[[ATTR1]] {
245 // CHECK1-NEXT: entry:
246 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
247 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
248 // CHECK1-NEXT: [[DOTPREVIOUS_LB__ADDR:%.*]] = alloca i64, align 8
249 // CHECK1-NEXT: [[DOTPREVIOUS_UB__ADDR:%.*]] = alloca i64, align 8
250 // CHECK1-NEXT: [[SIVAR_ADDR:%.*]] = alloca ptr, align 8
251 // CHECK1-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
252 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
253 // CHECK1-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
254 // CHECK1-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
255 // CHECK1-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
256 // CHECK1-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
257 // CHECK1-NEXT: [[SIVAR2:%.*]] = alloca i32, align 4
258 // CHECK1-NEXT: [[I:%.*]] = alloca i32, align 4
259 // CHECK1-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 8
260 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
261 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
262 // CHECK1-NEXT: store i64 [[DOTPREVIOUS_LB_]], ptr [[DOTPREVIOUS_LB__ADDR]], align 8
263 // CHECK1-NEXT: store i64 [[DOTPREVIOUS_UB_]], ptr [[DOTPREVIOUS_UB__ADDR]], align 8
264 // CHECK1-NEXT: store ptr [[SIVAR]], ptr [[SIVAR_ADDR]], align 8
265 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[SIVAR_ADDR]], align 8
266 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
267 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_UB]], align 4
268 // CHECK1-NEXT: [[TMP1:%.*]] = load i64, ptr [[DOTPREVIOUS_LB__ADDR]], align 8
269 // CHECK1-NEXT: [[CONV:%.*]] = trunc i64 [[TMP1]] to i32
270 // CHECK1-NEXT: [[TMP2:%.*]] = load i64, ptr [[DOTPREVIOUS_UB__ADDR]], align 8
271 // CHECK1-NEXT: [[CONV1:%.*]] = trunc i64 [[TMP2]] to i32
272 // CHECK1-NEXT: store i32 [[CONV]], ptr [[DOTOMP_LB]], align 4
273 // CHECK1-NEXT: store i32 [[CONV1]], ptr [[DOTOMP_UB]], align 4
274 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
275 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
276 // CHECK1-NEXT: store i32 0, ptr [[SIVAR2]], align 4
277 // CHECK1-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
278 // CHECK1-NEXT: [[TMP4:%.*]] = load i32, ptr [[TMP3]], align 4
279 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB2:[0-9]+]], i32 [[TMP4]], i32 34, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_LB]], ptr [[DOTOMP_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
280 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
281 // CHECK1-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP5]], 1
282 // CHECK1-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
283 // CHECK1: cond.true:
284 // CHECK1-NEXT: br label [[COND_END:%.*]]
285 // CHECK1: cond.false:
286 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
287 // CHECK1-NEXT: br label [[COND_END]]
289 // CHECK1-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP6]], [[COND_FALSE]] ]
290 // CHECK1-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
291 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
292 // CHECK1-NEXT: store i32 [[TMP7]], ptr [[DOTOMP_IV]], align 4
293 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
294 // CHECK1: omp.inner.for.cond:
295 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
296 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
297 // CHECK1-NEXT: [[CMP3:%.*]] = icmp sle i32 [[TMP8]], [[TMP9]]
298 // CHECK1-NEXT: br i1 [[CMP3]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
299 // CHECK1: omp.inner.for.body:
300 // CHECK1-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
301 // CHECK1-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP10]], 1
302 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
303 // CHECK1-NEXT: store i32 [[ADD]], ptr [[I]], align 4
304 // CHECK1-NEXT: [[TMP11:%.*]] = load i32, ptr [[I]], align 4
305 // CHECK1-NEXT: [[TMP12:%.*]] = load i32, ptr [[SIVAR2]], align 4
306 // CHECK1-NEXT: [[ADD4:%.*]] = add nsw i32 [[TMP12]], [[TMP11]]
307 // CHECK1-NEXT: store i32 [[ADD4]], ptr [[SIVAR2]], align 4
308 // CHECK1-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
309 // CHECK1: omp.body.continue:
310 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
311 // CHECK1: omp.inner.for.inc:
312 // CHECK1-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
313 // CHECK1-NEXT: [[ADD5:%.*]] = add nsw i32 [[TMP13]], 1
314 // CHECK1-NEXT: store i32 [[ADD5]], ptr [[DOTOMP_IV]], align 4
315 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]]
316 // CHECK1: omp.inner.for.end:
317 // CHECK1-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
318 // CHECK1: omp.loop.exit:
319 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP4]])
320 // CHECK1-NEXT: [[TMP14:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i64 0, i64 0
321 // CHECK1-NEXT: store ptr [[SIVAR2]], ptr [[TMP14]], align 8
322 // CHECK1-NEXT: [[TMP15:%.*]] = call i32 @__kmpc_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP4]], i32 1, i64 8, ptr [[DOTOMP_REDUCTION_RED_LIST]], ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l66.omp_outlined.omp_outlined.omp.reduction.reduction_func, ptr @.gomp_critical_user_.reduction.var)
323 // CHECK1-NEXT: switch i32 [[TMP15]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
324 // CHECK1-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
325 // CHECK1-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
327 // CHECK1: .omp.reduction.case1:
328 // CHECK1-NEXT: [[TMP16:%.*]] = load i32, ptr [[TMP0]], align 4
329 // CHECK1-NEXT: [[TMP17:%.*]] = load i32, ptr [[SIVAR2]], align 4
330 // CHECK1-NEXT: [[ADD6:%.*]] = add nsw i32 [[TMP16]], [[TMP17]]
331 // CHECK1-NEXT: store i32 [[ADD6]], ptr [[TMP0]], align 4
332 // CHECK1-NEXT: call void @__kmpc_end_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP4]], ptr @.gomp_critical_user_.reduction.var)
333 // CHECK1-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
334 // CHECK1: .omp.reduction.case2:
335 // CHECK1-NEXT: [[TMP18:%.*]] = load i32, ptr [[SIVAR2]], align 4
336 // CHECK1-NEXT: [[TMP19:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP18]] monotonic, align 4
337 // CHECK1-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
338 // CHECK1: .omp.reduction.default:
339 // CHECK1-NEXT: ret void
342 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l66.omp_outlined.omp_outlined.omp.reduction.reduction_func
343 // CHECK1-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR3:[0-9]+]] {
344 // CHECK1-NEXT: entry:
345 // CHECK1-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 8
346 // CHECK1-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 8
347 // CHECK1-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 8
348 // CHECK1-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 8
349 // CHECK1-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 8
350 // CHECK1-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 8
351 // CHECK1-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i64 0, i64 0
352 // CHECK1-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 8
353 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i64 0, i64 0
354 // CHECK1-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 8
355 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
356 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
357 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
358 // CHECK1-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
359 // CHECK1-NEXT: ret void
362 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l66.omp_outlined.omp.reduction.reduction_func
363 // CHECK1-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR3]] {
364 // CHECK1-NEXT: entry:
365 // CHECK1-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 8
366 // CHECK1-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 8
367 // CHECK1-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 8
368 // CHECK1-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 8
369 // CHECK1-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 8
370 // CHECK1-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 8
371 // CHECK1-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i64 0, i64 0
372 // CHECK1-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 8
373 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i64 0, i64 0
374 // CHECK1-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 8
375 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
376 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
377 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
378 // CHECK1-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
379 // CHECK1-NEXT: ret void
382 // CHECK1-LABEL: define {{[^@]+}}@_Z5tmainIiET_v
383 // CHECK1-SAME: () #[[ATTR5:[0-9]+]] comdat {
384 // CHECK1-NEXT: entry:
385 // CHECK1-NEXT: [[T_VAR:%.*]] = alloca i32, align 4
386 // CHECK1-NEXT: [[VEC:%.*]] = alloca [2 x i32], align 4
387 // CHECK1-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [1 x ptr], align 8
388 // CHECK1-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [1 x ptr], align 8
389 // CHECK1-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [1 x ptr], align 8
390 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
391 // CHECK1-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
392 // CHECK1-NEXT: store i32 0, ptr [[T_VAR]], align 4
393 // CHECK1-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[VEC]], ptr align 4 @__const._Z5tmainIiET_v.vec, i64 8, i1 false)
394 // CHECK1-NEXT: [[TMP0:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
395 // CHECK1-NEXT: store ptr [[T_VAR]], ptr [[TMP0]], align 8
396 // CHECK1-NEXT: [[TMP1:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
397 // CHECK1-NEXT: store ptr [[T_VAR]], ptr [[TMP1]], align 8
398 // CHECK1-NEXT: [[TMP2:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 0
399 // CHECK1-NEXT: store ptr null, ptr [[TMP2]], align 8
400 // CHECK1-NEXT: [[TMP3:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
401 // CHECK1-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
402 // CHECK1-NEXT: [[TMP5:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
403 // CHECK1-NEXT: store i32 2, ptr [[TMP5]], align 4
404 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
405 // CHECK1-NEXT: store i32 1, ptr [[TMP6]], align 4
406 // CHECK1-NEXT: [[TMP7:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
407 // CHECK1-NEXT: store ptr [[TMP3]], ptr [[TMP7]], align 8
408 // CHECK1-NEXT: [[TMP8:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
409 // CHECK1-NEXT: store ptr [[TMP4]], ptr [[TMP8]], align 8
410 // CHECK1-NEXT: [[TMP9:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
411 // CHECK1-NEXT: store ptr @.offload_sizes.1, ptr [[TMP9]], align 8
412 // CHECK1-NEXT: [[TMP10:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
413 // CHECK1-NEXT: store ptr @.offload_maptypes.2, ptr [[TMP10]], align 8
414 // CHECK1-NEXT: [[TMP11:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
415 // CHECK1-NEXT: store ptr null, ptr [[TMP11]], align 8
416 // CHECK1-NEXT: [[TMP12:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
417 // CHECK1-NEXT: store ptr null, ptr [[TMP12]], align 8
418 // CHECK1-NEXT: [[TMP13:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
419 // CHECK1-NEXT: store i64 2, ptr [[TMP13]], align 8
420 // CHECK1-NEXT: [[TMP14:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
421 // CHECK1-NEXT: store i64 0, ptr [[TMP14]], align 8
422 // CHECK1-NEXT: [[TMP15:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
423 // CHECK1-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP15]], align 4
424 // CHECK1-NEXT: [[TMP16:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
425 // CHECK1-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP16]], align 4
426 // CHECK1-NEXT: [[TMP17:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
427 // CHECK1-NEXT: store i32 0, ptr [[TMP17]], align 4
428 // CHECK1-NEXT: [[TMP18:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB4]], i64 -1, i32 0, i32 0, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.region_id, ptr [[KERNEL_ARGS]])
429 // CHECK1-NEXT: [[TMP19:%.*]] = icmp ne i32 [[TMP18]], 0
430 // CHECK1-NEXT: br i1 [[TMP19]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
431 // CHECK1: omp_offload.failed:
432 // CHECK1-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32(ptr [[T_VAR]]) #[[ATTR2]]
433 // CHECK1-NEXT: br label [[OMP_OFFLOAD_CONT]]
434 // CHECK1: omp_offload.cont:
435 // CHECK1-NEXT: ret i32 0
438 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32
439 // CHECK1-SAME: (ptr noundef nonnull align 4 dereferenceable(4) [[T_VAR:%.*]]) #[[ATTR1]] {
440 // CHECK1-NEXT: entry:
441 // CHECK1-NEXT: [[T_VAR_ADDR:%.*]] = alloca ptr, align 8
442 // CHECK1-NEXT: store ptr [[T_VAR]], ptr [[T_VAR_ADDR]], align 8
443 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[T_VAR_ADDR]], align 8
444 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB4]], i32 1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined, ptr [[TMP0]])
445 // CHECK1-NEXT: ret void
448 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined
449 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[T_VAR:%.*]]) #[[ATTR1]] {
450 // CHECK1-NEXT: entry:
451 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
452 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
453 // CHECK1-NEXT: [[T_VAR_ADDR:%.*]] = alloca ptr, align 8
454 // CHECK1-NEXT: [[T_VAR1:%.*]] = alloca i32, align 4
455 // CHECK1-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
456 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
457 // CHECK1-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
458 // CHECK1-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
459 // CHECK1-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
460 // CHECK1-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
461 // CHECK1-NEXT: [[I:%.*]] = alloca i32, align 4
462 // CHECK1-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 8
463 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
464 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
465 // CHECK1-NEXT: store ptr [[T_VAR]], ptr [[T_VAR_ADDR]], align 8
466 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[T_VAR_ADDR]], align 8
467 // CHECK1-NEXT: store i32 0, ptr [[T_VAR1]], align 4
468 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
469 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_COMB_UB]], align 4
470 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
471 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
472 // CHECK1-NEXT: [[TMP1:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
473 // CHECK1-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP1]], align 4
474 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1]], i32 [[TMP2]], i32 92, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_COMB_LB]], ptr [[DOTOMP_COMB_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
475 // CHECK1-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
476 // CHECK1-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP3]], 1
477 // CHECK1-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
478 // CHECK1: cond.true:
479 // CHECK1-NEXT: br label [[COND_END:%.*]]
480 // CHECK1: cond.false:
481 // CHECK1-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
482 // CHECK1-NEXT: br label [[COND_END]]
484 // CHECK1-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP4]], [[COND_FALSE]] ]
485 // CHECK1-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
486 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
487 // CHECK1-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_IV]], align 4
488 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
489 // CHECK1: omp.inner.for.cond:
490 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
491 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
492 // CHECK1-NEXT: [[CMP2:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
493 // CHECK1-NEXT: br i1 [[CMP2]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
494 // CHECK1: omp.inner.for.body:
495 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
496 // CHECK1-NEXT: [[TMP9:%.*]] = zext i32 [[TMP8]] to i64
497 // CHECK1-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
498 // CHECK1-NEXT: [[TMP11:%.*]] = zext i32 [[TMP10]] to i64
499 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB4]], i32 3, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined.omp_outlined, i64 [[TMP9]], i64 [[TMP11]], ptr [[T_VAR1]])
500 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
501 // CHECK1: omp.inner.for.inc:
502 // CHECK1-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
503 // CHECK1-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_STRIDE]], align 4
504 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP12]], [[TMP13]]
505 // CHECK1-NEXT: store i32 [[ADD]], ptr [[DOTOMP_IV]], align 4
506 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]]
507 // CHECK1: omp.inner.for.end:
508 // CHECK1-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
509 // CHECK1: omp.loop.exit:
510 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP2]])
511 // CHECK1-NEXT: [[TMP14:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i64 0, i64 0
512 // CHECK1-NEXT: store ptr [[T_VAR1]], ptr [[TMP14]], align 8
513 // CHECK1-NEXT: [[TMP15:%.*]] = call i32 @__kmpc_reduce_nowait(ptr @[[GLOB3]], 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)
514 // CHECK1-NEXT: switch i32 [[TMP15]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
515 // CHECK1-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
516 // CHECK1-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
518 // CHECK1: .omp.reduction.case1:
519 // CHECK1-NEXT: [[TMP16:%.*]] = load i32, ptr [[TMP0]], align 4
520 // CHECK1-NEXT: [[TMP17:%.*]] = load i32, ptr [[T_VAR1]], align 4
521 // CHECK1-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP16]], [[TMP17]]
522 // CHECK1-NEXT: store i32 [[ADD3]], ptr [[TMP0]], align 4
523 // CHECK1-NEXT: call void @__kmpc_end_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP2]], ptr @.gomp_critical_user_.reduction.var)
524 // CHECK1-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
525 // CHECK1: .omp.reduction.case2:
526 // CHECK1-NEXT: [[TMP18:%.*]] = load i32, ptr [[T_VAR1]], align 4
527 // CHECK1-NEXT: [[TMP19:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP18]] monotonic, align 4
528 // CHECK1-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
529 // CHECK1: .omp.reduction.default:
530 // CHECK1-NEXT: ret void
533 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined.omp_outlined
534 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], i64 noundef [[DOTPREVIOUS_LB_:%.*]], i64 noundef [[DOTPREVIOUS_UB_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[T_VAR:%.*]]) #[[ATTR1]] {
535 // CHECK1-NEXT: entry:
536 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
537 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
538 // CHECK1-NEXT: [[DOTPREVIOUS_LB__ADDR:%.*]] = alloca i64, align 8
539 // CHECK1-NEXT: [[DOTPREVIOUS_UB__ADDR:%.*]] = alloca i64, align 8
540 // CHECK1-NEXT: [[T_VAR_ADDR:%.*]] = alloca ptr, align 8
541 // CHECK1-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
542 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
543 // CHECK1-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
544 // CHECK1-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
545 // CHECK1-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
546 // CHECK1-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
547 // CHECK1-NEXT: [[T_VAR2:%.*]] = alloca i32, align 4
548 // CHECK1-NEXT: [[I:%.*]] = alloca i32, align 4
549 // CHECK1-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 8
550 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
551 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
552 // CHECK1-NEXT: store i64 [[DOTPREVIOUS_LB_]], ptr [[DOTPREVIOUS_LB__ADDR]], align 8
553 // CHECK1-NEXT: store i64 [[DOTPREVIOUS_UB_]], ptr [[DOTPREVIOUS_UB__ADDR]], align 8
554 // CHECK1-NEXT: store ptr [[T_VAR]], ptr [[T_VAR_ADDR]], align 8
555 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[T_VAR_ADDR]], align 8
556 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
557 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_UB]], align 4
558 // CHECK1-NEXT: [[TMP1:%.*]] = load i64, ptr [[DOTPREVIOUS_LB__ADDR]], align 8
559 // CHECK1-NEXT: [[CONV:%.*]] = trunc i64 [[TMP1]] to i32
560 // CHECK1-NEXT: [[TMP2:%.*]] = load i64, ptr [[DOTPREVIOUS_UB__ADDR]], align 8
561 // CHECK1-NEXT: [[CONV1:%.*]] = trunc i64 [[TMP2]] to i32
562 // CHECK1-NEXT: store i32 [[CONV]], ptr [[DOTOMP_LB]], align 4
563 // CHECK1-NEXT: store i32 [[CONV1]], ptr [[DOTOMP_UB]], align 4
564 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
565 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
566 // CHECK1-NEXT: store i32 0, ptr [[T_VAR2]], align 4
567 // CHECK1-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
568 // CHECK1-NEXT: [[TMP4:%.*]] = load i32, ptr [[TMP3]], align 4
569 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB2]], i32 [[TMP4]], i32 34, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_LB]], ptr [[DOTOMP_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
570 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
571 // CHECK1-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP5]], 1
572 // CHECK1-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
573 // CHECK1: cond.true:
574 // CHECK1-NEXT: br label [[COND_END:%.*]]
575 // CHECK1: cond.false:
576 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
577 // CHECK1-NEXT: br label [[COND_END]]
579 // CHECK1-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP6]], [[COND_FALSE]] ]
580 // CHECK1-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
581 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
582 // CHECK1-NEXT: store i32 [[TMP7]], ptr [[DOTOMP_IV]], align 4
583 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
584 // CHECK1: omp.inner.for.cond:
585 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
586 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
587 // CHECK1-NEXT: [[CMP3:%.*]] = icmp sle i32 [[TMP8]], [[TMP9]]
588 // CHECK1-NEXT: br i1 [[CMP3]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
589 // CHECK1: omp.inner.for.body:
590 // CHECK1-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
591 // CHECK1-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP10]], 1
592 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
593 // CHECK1-NEXT: store i32 [[ADD]], ptr [[I]], align 4
594 // CHECK1-NEXT: [[TMP11:%.*]] = load i32, ptr [[I]], align 4
595 // CHECK1-NEXT: [[TMP12:%.*]] = load i32, ptr [[T_VAR2]], align 4
596 // CHECK1-NEXT: [[ADD4:%.*]] = add nsw i32 [[TMP12]], [[TMP11]]
597 // CHECK1-NEXT: store i32 [[ADD4]], ptr [[T_VAR2]], align 4
598 // CHECK1-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
599 // CHECK1: omp.body.continue:
600 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
601 // CHECK1: omp.inner.for.inc:
602 // CHECK1-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
603 // CHECK1-NEXT: [[ADD5:%.*]] = add nsw i32 [[TMP13]], 1
604 // CHECK1-NEXT: store i32 [[ADD5]], ptr [[DOTOMP_IV]], align 4
605 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]]
606 // CHECK1: omp.inner.for.end:
607 // CHECK1-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
608 // CHECK1: omp.loop.exit:
609 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP4]])
610 // CHECK1-NEXT: [[TMP14:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i64 0, i64 0
611 // CHECK1-NEXT: store ptr [[T_VAR2]], ptr [[TMP14]], align 8
612 // CHECK1-NEXT: [[TMP15:%.*]] = call i32 @__kmpc_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP4]], i32 1, i64 8, ptr [[DOTOMP_REDUCTION_RED_LIST]], ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined.omp_outlined.omp.reduction.reduction_func, ptr @.gomp_critical_user_.reduction.var)
613 // CHECK1-NEXT: switch i32 [[TMP15]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
614 // CHECK1-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
615 // CHECK1-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
617 // CHECK1: .omp.reduction.case1:
618 // CHECK1-NEXT: [[TMP16:%.*]] = load i32, ptr [[TMP0]], align 4
619 // CHECK1-NEXT: [[TMP17:%.*]] = load i32, ptr [[T_VAR2]], align 4
620 // CHECK1-NEXT: [[ADD6:%.*]] = add nsw i32 [[TMP16]], [[TMP17]]
621 // CHECK1-NEXT: store i32 [[ADD6]], ptr [[TMP0]], align 4
622 // CHECK1-NEXT: call void @__kmpc_end_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP4]], ptr @.gomp_critical_user_.reduction.var)
623 // CHECK1-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
624 // CHECK1: .omp.reduction.case2:
625 // CHECK1-NEXT: [[TMP18:%.*]] = load i32, ptr [[T_VAR2]], align 4
626 // CHECK1-NEXT: [[TMP19:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP18]] monotonic, align 4
627 // CHECK1-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
628 // CHECK1: .omp.reduction.default:
629 // CHECK1-NEXT: ret void
632 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined.omp_outlined.omp.reduction.reduction_func
633 // CHECK1-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR3]] {
634 // CHECK1-NEXT: entry:
635 // CHECK1-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 8
636 // CHECK1-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 8
637 // CHECK1-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 8
638 // CHECK1-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 8
639 // CHECK1-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 8
640 // CHECK1-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 8
641 // CHECK1-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i64 0, i64 0
642 // CHECK1-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 8
643 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i64 0, i64 0
644 // CHECK1-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 8
645 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
646 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
647 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
648 // CHECK1-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
649 // CHECK1-NEXT: ret void
652 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined.omp.reduction.reduction_func
653 // CHECK1-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR3]] {
654 // CHECK1-NEXT: entry:
655 // CHECK1-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 8
656 // CHECK1-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 8
657 // CHECK1-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 8
658 // CHECK1-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 8
659 // CHECK1-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 8
660 // CHECK1-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 8
661 // CHECK1-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i64 0, i64 0
662 // CHECK1-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 8
663 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i64 0, i64 0
664 // CHECK1-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 8
665 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
666 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
667 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
668 // CHECK1-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
669 // CHECK1-NEXT: ret void
672 // CHECK1-LABEL: define {{[^@]+}}@.omp_offloading.requires_reg
673 // CHECK1-SAME: () #[[ATTR7:[0-9]+]] {
674 // CHECK1-NEXT: entry:
675 // CHECK1-NEXT: call void @__tgt_register_requires(i64 1)
676 // CHECK1-NEXT: ret void
679 // CHECK3-LABEL: define {{[^@]+}}@main
680 // CHECK3-SAME: () #[[ATTR0:[0-9]+]] {
681 // CHECK3-NEXT: entry:
682 // CHECK3-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
683 // CHECK3-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [1 x ptr], align 4
684 // CHECK3-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [1 x ptr], align 4
685 // CHECK3-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [1 x ptr], align 4
686 // CHECK3-NEXT: [[TMP:%.*]] = alloca i32, align 4
687 // CHECK3-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
688 // CHECK3-NEXT: store i32 0, ptr [[RETVAL]], align 4
689 // CHECK3-NEXT: [[TMP0:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
690 // CHECK3-NEXT: store ptr @_ZZ4mainE5sivar, ptr [[TMP0]], align 4
691 // CHECK3-NEXT: [[TMP1:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
692 // CHECK3-NEXT: store ptr @_ZZ4mainE5sivar, ptr [[TMP1]], align 4
693 // CHECK3-NEXT: [[TMP2:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i32 0, i32 0
694 // CHECK3-NEXT: store ptr null, ptr [[TMP2]], align 4
695 // CHECK3-NEXT: [[TMP3:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
696 // CHECK3-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
697 // CHECK3-NEXT: [[TMP5:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
698 // CHECK3-NEXT: store i32 2, ptr [[TMP5]], align 4
699 // CHECK3-NEXT: [[TMP6:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
700 // CHECK3-NEXT: store i32 1, ptr [[TMP6]], align 4
701 // CHECK3-NEXT: [[TMP7:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
702 // CHECK3-NEXT: store ptr [[TMP3]], ptr [[TMP7]], align 4
703 // CHECK3-NEXT: [[TMP8:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
704 // CHECK3-NEXT: store ptr [[TMP4]], ptr [[TMP8]], align 4
705 // CHECK3-NEXT: [[TMP9:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
706 // CHECK3-NEXT: store ptr @.offload_sizes, ptr [[TMP9]], align 4
707 // CHECK3-NEXT: [[TMP10:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
708 // CHECK3-NEXT: store ptr @.offload_maptypes, ptr [[TMP10]], align 4
709 // CHECK3-NEXT: [[TMP11:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
710 // CHECK3-NEXT: store ptr null, ptr [[TMP11]], align 4
711 // CHECK3-NEXT: [[TMP12:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
712 // CHECK3-NEXT: store ptr null, ptr [[TMP12]], align 4
713 // CHECK3-NEXT: [[TMP13:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
714 // CHECK3-NEXT: store i64 2, ptr [[TMP13]], align 8
715 // CHECK3-NEXT: [[TMP14:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
716 // CHECK3-NEXT: store i64 0, ptr [[TMP14]], align 8
717 // CHECK3-NEXT: [[TMP15:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
718 // CHECK3-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP15]], align 4
719 // CHECK3-NEXT: [[TMP16:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
720 // CHECK3-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP16]], align 4
721 // CHECK3-NEXT: [[TMP17:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
722 // CHECK3-NEXT: store i32 0, ptr [[TMP17]], align 4
723 // CHECK3-NEXT: [[TMP18:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB4:[0-9]+]], i64 -1, i32 0, i32 0, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l66.region_id, ptr [[KERNEL_ARGS]])
724 // CHECK3-NEXT: [[TMP19:%.*]] = icmp ne i32 [[TMP18]], 0
725 // CHECK3-NEXT: br i1 [[TMP19]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
726 // CHECK3: omp_offload.failed:
727 // CHECK3-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l66(ptr @_ZZ4mainE5sivar) #[[ATTR2:[0-9]+]]
728 // CHECK3-NEXT: br label [[OMP_OFFLOAD_CONT]]
729 // CHECK3: omp_offload.cont:
730 // CHECK3-NEXT: [[CALL:%.*]] = call noundef i32 @_Z5tmainIiET_v()
731 // CHECK3-NEXT: ret i32 [[CALL]]
734 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l66
735 // CHECK3-SAME: (ptr noundef nonnull align 4 dereferenceable(4) [[SIVAR:%.*]]) #[[ATTR1:[0-9]+]] {
736 // CHECK3-NEXT: entry:
737 // CHECK3-NEXT: [[SIVAR_ADDR:%.*]] = alloca ptr, align 4
738 // CHECK3-NEXT: store ptr [[SIVAR]], ptr [[SIVAR_ADDR]], align 4
739 // CHECK3-NEXT: [[TMP0:%.*]] = load ptr, ptr [[SIVAR_ADDR]], align 4
740 // CHECK3-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB4]], i32 1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l66.omp_outlined, ptr [[TMP0]])
741 // CHECK3-NEXT: ret void
744 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l66.omp_outlined
745 // CHECK3-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[SIVAR:%.*]]) #[[ATTR1]] {
746 // CHECK3-NEXT: entry:
747 // CHECK3-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 4
748 // CHECK3-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 4
749 // CHECK3-NEXT: [[SIVAR_ADDR:%.*]] = alloca ptr, align 4
750 // CHECK3-NEXT: [[SIVAR1:%.*]] = alloca i32, align 4
751 // CHECK3-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
752 // CHECK3-NEXT: [[TMP:%.*]] = alloca i32, align 4
753 // CHECK3-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
754 // CHECK3-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
755 // CHECK3-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
756 // CHECK3-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
757 // CHECK3-NEXT: [[I:%.*]] = alloca i32, align 4
758 // CHECK3-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 4
759 // CHECK3-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 4
760 // CHECK3-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 4
761 // CHECK3-NEXT: store ptr [[SIVAR]], ptr [[SIVAR_ADDR]], align 4
762 // CHECK3-NEXT: [[TMP0:%.*]] = load ptr, ptr [[SIVAR_ADDR]], align 4
763 // CHECK3-NEXT: store i32 0, ptr [[SIVAR1]], align 4
764 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
765 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_COMB_UB]], align 4
766 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
767 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
768 // CHECK3-NEXT: [[TMP1:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 4
769 // CHECK3-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP1]], align 4
770 // CHECK3-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1:[0-9]+]], i32 [[TMP2]], i32 92, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_COMB_LB]], ptr [[DOTOMP_COMB_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
771 // CHECK3-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
772 // CHECK3-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP3]], 1
773 // CHECK3-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
774 // CHECK3: cond.true:
775 // CHECK3-NEXT: br label [[COND_END:%.*]]
776 // CHECK3: cond.false:
777 // CHECK3-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
778 // CHECK3-NEXT: br label [[COND_END]]
780 // CHECK3-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP4]], [[COND_FALSE]] ]
781 // CHECK3-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
782 // CHECK3-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
783 // CHECK3-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_IV]], align 4
784 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
785 // CHECK3: omp.inner.for.cond:
786 // CHECK3-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
787 // CHECK3-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
788 // CHECK3-NEXT: [[CMP2:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
789 // CHECK3-NEXT: br i1 [[CMP2]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
790 // CHECK3: omp.inner.for.body:
791 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
792 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
793 // CHECK3-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB4]], i32 3, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l66.omp_outlined.omp_outlined, i32 [[TMP8]], i32 [[TMP9]], ptr [[SIVAR1]])
794 // CHECK3-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
795 // CHECK3: omp.inner.for.inc:
796 // CHECK3-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
797 // CHECK3-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_STRIDE]], align 4
798 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP10]], [[TMP11]]
799 // CHECK3-NEXT: store i32 [[ADD]], ptr [[DOTOMP_IV]], align 4
800 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND]]
801 // CHECK3: omp.inner.for.end:
802 // CHECK3-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
803 // CHECK3: omp.loop.exit:
804 // CHECK3-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP2]])
805 // CHECK3-NEXT: [[TMP12:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i32 0, i32 0
806 // CHECK3-NEXT: store ptr [[SIVAR1]], ptr [[TMP12]], align 4
807 // CHECK3-NEXT: [[TMP13:%.*]] = call i32 @__kmpc_reduce_nowait(ptr @[[GLOB3:[0-9]+]], i32 [[TMP2]], i32 1, i32 4, ptr [[DOTOMP_REDUCTION_RED_LIST]], ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l66.omp_outlined.omp.reduction.reduction_func, ptr @.gomp_critical_user_.reduction.var)
808 // CHECK3-NEXT: switch i32 [[TMP13]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
809 // CHECK3-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
810 // CHECK3-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
812 // CHECK3: .omp.reduction.case1:
813 // CHECK3-NEXT: [[TMP14:%.*]] = load i32, ptr [[TMP0]], align 4
814 // CHECK3-NEXT: [[TMP15:%.*]] = load i32, ptr [[SIVAR1]], align 4
815 // CHECK3-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP14]], [[TMP15]]
816 // CHECK3-NEXT: store i32 [[ADD3]], ptr [[TMP0]], align 4
817 // CHECK3-NEXT: call void @__kmpc_end_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP2]], ptr @.gomp_critical_user_.reduction.var)
818 // CHECK3-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
819 // CHECK3: .omp.reduction.case2:
820 // CHECK3-NEXT: [[TMP16:%.*]] = load i32, ptr [[SIVAR1]], align 4
821 // CHECK3-NEXT: [[TMP17:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP16]] monotonic, align 4
822 // CHECK3-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
823 // CHECK3: .omp.reduction.default:
824 // CHECK3-NEXT: ret void
827 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l66.omp_outlined.omp_outlined
828 // CHECK3-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], i32 noundef [[DOTPREVIOUS_LB_:%.*]], i32 noundef [[DOTPREVIOUS_UB_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[SIVAR:%.*]]) #[[ATTR1]] {
829 // CHECK3-NEXT: entry:
830 // CHECK3-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 4
831 // CHECK3-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 4
832 // CHECK3-NEXT: [[DOTPREVIOUS_LB__ADDR:%.*]] = alloca i32, align 4
833 // CHECK3-NEXT: [[DOTPREVIOUS_UB__ADDR:%.*]] = alloca i32, align 4
834 // CHECK3-NEXT: [[SIVAR_ADDR:%.*]] = alloca ptr, align 4
835 // CHECK3-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
836 // CHECK3-NEXT: [[TMP:%.*]] = alloca i32, align 4
837 // CHECK3-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
838 // CHECK3-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
839 // CHECK3-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
840 // CHECK3-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
841 // CHECK3-NEXT: [[SIVAR1:%.*]] = alloca i32, align 4
842 // CHECK3-NEXT: [[I:%.*]] = alloca i32, align 4
843 // CHECK3-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 4
844 // CHECK3-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 4
845 // CHECK3-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 4
846 // CHECK3-NEXT: store i32 [[DOTPREVIOUS_LB_]], ptr [[DOTPREVIOUS_LB__ADDR]], align 4
847 // CHECK3-NEXT: store i32 [[DOTPREVIOUS_UB_]], ptr [[DOTPREVIOUS_UB__ADDR]], align 4
848 // CHECK3-NEXT: store ptr [[SIVAR]], ptr [[SIVAR_ADDR]], align 4
849 // CHECK3-NEXT: [[TMP0:%.*]] = load ptr, ptr [[SIVAR_ADDR]], align 4
850 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
851 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_UB]], align 4
852 // CHECK3-NEXT: [[TMP1:%.*]] = load i32, ptr [[DOTPREVIOUS_LB__ADDR]], align 4
853 // CHECK3-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTPREVIOUS_UB__ADDR]], align 4
854 // CHECK3-NEXT: store i32 [[TMP1]], ptr [[DOTOMP_LB]], align 4
855 // CHECK3-NEXT: store i32 [[TMP2]], ptr [[DOTOMP_UB]], align 4
856 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
857 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
858 // CHECK3-NEXT: store i32 0, ptr [[SIVAR1]], align 4
859 // CHECK3-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 4
860 // CHECK3-NEXT: [[TMP4:%.*]] = load i32, ptr [[TMP3]], align 4
861 // CHECK3-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB2:[0-9]+]], i32 [[TMP4]], i32 34, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_LB]], ptr [[DOTOMP_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
862 // CHECK3-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
863 // CHECK3-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP5]], 1
864 // CHECK3-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
865 // CHECK3: cond.true:
866 // CHECK3-NEXT: br label [[COND_END:%.*]]
867 // CHECK3: cond.false:
868 // CHECK3-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
869 // CHECK3-NEXT: br label [[COND_END]]
871 // CHECK3-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP6]], [[COND_FALSE]] ]
872 // CHECK3-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
873 // CHECK3-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
874 // CHECK3-NEXT: store i32 [[TMP7]], ptr [[DOTOMP_IV]], align 4
875 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
876 // CHECK3: omp.inner.for.cond:
877 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
878 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
879 // CHECK3-NEXT: [[CMP2:%.*]] = icmp sle i32 [[TMP8]], [[TMP9]]
880 // CHECK3-NEXT: br i1 [[CMP2]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
881 // CHECK3: omp.inner.for.body:
882 // CHECK3-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
883 // CHECK3-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP10]], 1
884 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
885 // CHECK3-NEXT: store i32 [[ADD]], ptr [[I]], align 4
886 // CHECK3-NEXT: [[TMP11:%.*]] = load i32, ptr [[I]], align 4
887 // CHECK3-NEXT: [[TMP12:%.*]] = load i32, ptr [[SIVAR1]], align 4
888 // CHECK3-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP12]], [[TMP11]]
889 // CHECK3-NEXT: store i32 [[ADD3]], ptr [[SIVAR1]], align 4
890 // CHECK3-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
891 // CHECK3: omp.body.continue:
892 // CHECK3-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
893 // CHECK3: omp.inner.for.inc:
894 // CHECK3-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
895 // CHECK3-NEXT: [[ADD4:%.*]] = add nsw i32 [[TMP13]], 1
896 // CHECK3-NEXT: store i32 [[ADD4]], ptr [[DOTOMP_IV]], align 4
897 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND]]
898 // CHECK3: omp.inner.for.end:
899 // CHECK3-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
900 // CHECK3: omp.loop.exit:
901 // CHECK3-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP4]])
902 // CHECK3-NEXT: [[TMP14:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i32 0, i32 0
903 // CHECK3-NEXT: store ptr [[SIVAR1]], ptr [[TMP14]], align 4
904 // CHECK3-NEXT: [[TMP15:%.*]] = call i32 @__kmpc_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP4]], i32 1, i32 4, ptr [[DOTOMP_REDUCTION_RED_LIST]], ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l66.omp_outlined.omp_outlined.omp.reduction.reduction_func, ptr @.gomp_critical_user_.reduction.var)
905 // CHECK3-NEXT: switch i32 [[TMP15]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
906 // CHECK3-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
907 // CHECK3-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
909 // CHECK3: .omp.reduction.case1:
910 // CHECK3-NEXT: [[TMP16:%.*]] = load i32, ptr [[TMP0]], align 4
911 // CHECK3-NEXT: [[TMP17:%.*]] = load i32, ptr [[SIVAR1]], align 4
912 // CHECK3-NEXT: [[ADD5:%.*]] = add nsw i32 [[TMP16]], [[TMP17]]
913 // CHECK3-NEXT: store i32 [[ADD5]], ptr [[TMP0]], align 4
914 // CHECK3-NEXT: call void @__kmpc_end_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP4]], ptr @.gomp_critical_user_.reduction.var)
915 // CHECK3-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
916 // CHECK3: .omp.reduction.case2:
917 // CHECK3-NEXT: [[TMP18:%.*]] = load i32, ptr [[SIVAR1]], align 4
918 // CHECK3-NEXT: [[TMP19:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP18]] monotonic, align 4
919 // CHECK3-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
920 // CHECK3: .omp.reduction.default:
921 // CHECK3-NEXT: ret void
924 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l66.omp_outlined.omp_outlined.omp.reduction.reduction_func
925 // CHECK3-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR3:[0-9]+]] {
926 // CHECK3-NEXT: entry:
927 // CHECK3-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 4
928 // CHECK3-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 4
929 // CHECK3-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 4
930 // CHECK3-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 4
931 // CHECK3-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 4
932 // CHECK3-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 4
933 // CHECK3-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i32 0, i32 0
934 // CHECK3-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 4
935 // CHECK3-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i32 0, i32 0
936 // CHECK3-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 4
937 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
938 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
939 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
940 // CHECK3-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
941 // CHECK3-NEXT: ret void
944 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l66.omp_outlined.omp.reduction.reduction_func
945 // CHECK3-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR3]] {
946 // CHECK3-NEXT: entry:
947 // CHECK3-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 4
948 // CHECK3-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 4
949 // CHECK3-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 4
950 // CHECK3-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 4
951 // CHECK3-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 4
952 // CHECK3-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 4
953 // CHECK3-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i32 0, i32 0
954 // CHECK3-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 4
955 // CHECK3-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i32 0, i32 0
956 // CHECK3-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 4
957 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
958 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
959 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
960 // CHECK3-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
961 // CHECK3-NEXT: ret void
964 // CHECK3-LABEL: define {{[^@]+}}@_Z5tmainIiET_v
965 // CHECK3-SAME: () #[[ATTR5:[0-9]+]] comdat {
966 // CHECK3-NEXT: entry:
967 // CHECK3-NEXT: [[T_VAR:%.*]] = alloca i32, align 4
968 // CHECK3-NEXT: [[VEC:%.*]] = alloca [2 x i32], align 4
969 // CHECK3-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [1 x ptr], align 4
970 // CHECK3-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [1 x ptr], align 4
971 // CHECK3-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [1 x ptr], align 4
972 // CHECK3-NEXT: [[TMP:%.*]] = alloca i32, align 4
973 // CHECK3-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
974 // CHECK3-NEXT: store i32 0, ptr [[T_VAR]], align 4
975 // CHECK3-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 4 [[VEC]], ptr align 4 @__const._Z5tmainIiET_v.vec, i32 8, i1 false)
976 // CHECK3-NEXT: [[TMP0:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
977 // CHECK3-NEXT: store ptr [[T_VAR]], ptr [[TMP0]], align 4
978 // CHECK3-NEXT: [[TMP1:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
979 // CHECK3-NEXT: store ptr [[T_VAR]], ptr [[TMP1]], align 4
980 // CHECK3-NEXT: [[TMP2:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i32 0, i32 0
981 // CHECK3-NEXT: store ptr null, ptr [[TMP2]], align 4
982 // CHECK3-NEXT: [[TMP3:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
983 // CHECK3-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
984 // CHECK3-NEXT: [[TMP5:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
985 // CHECK3-NEXT: store i32 2, ptr [[TMP5]], align 4
986 // CHECK3-NEXT: [[TMP6:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
987 // CHECK3-NEXT: store i32 1, ptr [[TMP6]], align 4
988 // CHECK3-NEXT: [[TMP7:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
989 // CHECK3-NEXT: store ptr [[TMP3]], ptr [[TMP7]], align 4
990 // CHECK3-NEXT: [[TMP8:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
991 // CHECK3-NEXT: store ptr [[TMP4]], ptr [[TMP8]], align 4
992 // CHECK3-NEXT: [[TMP9:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
993 // CHECK3-NEXT: store ptr @.offload_sizes.1, ptr [[TMP9]], align 4
994 // CHECK3-NEXT: [[TMP10:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
995 // CHECK3-NEXT: store ptr @.offload_maptypes.2, ptr [[TMP10]], align 4
996 // CHECK3-NEXT: [[TMP11:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
997 // CHECK3-NEXT: store ptr null, ptr [[TMP11]], align 4
998 // CHECK3-NEXT: [[TMP12:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
999 // CHECK3-NEXT: store ptr null, ptr [[TMP12]], align 4
1000 // CHECK3-NEXT: [[TMP13:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
1001 // CHECK3-NEXT: store i64 2, ptr [[TMP13]], align 8
1002 // CHECK3-NEXT: [[TMP14:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
1003 // CHECK3-NEXT: store i64 0, ptr [[TMP14]], align 8
1004 // CHECK3-NEXT: [[TMP15:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
1005 // CHECK3-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP15]], align 4
1006 // CHECK3-NEXT: [[TMP16:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
1007 // CHECK3-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP16]], align 4
1008 // CHECK3-NEXT: [[TMP17:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
1009 // CHECK3-NEXT: store i32 0, ptr [[TMP17]], align 4
1010 // CHECK3-NEXT: [[TMP18:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB4]], i64 -1, i32 0, i32 0, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.region_id, ptr [[KERNEL_ARGS]])
1011 // CHECK3-NEXT: [[TMP19:%.*]] = icmp ne i32 [[TMP18]], 0
1012 // CHECK3-NEXT: br i1 [[TMP19]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
1013 // CHECK3: omp_offload.failed:
1014 // CHECK3-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32(ptr [[T_VAR]]) #[[ATTR2]]
1015 // CHECK3-NEXT: br label [[OMP_OFFLOAD_CONT]]
1016 // CHECK3: omp_offload.cont:
1017 // CHECK3-NEXT: ret i32 0
1020 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32
1021 // CHECK3-SAME: (ptr noundef nonnull align 4 dereferenceable(4) [[T_VAR:%.*]]) #[[ATTR1]] {
1022 // CHECK3-NEXT: entry:
1023 // CHECK3-NEXT: [[T_VAR_ADDR:%.*]] = alloca ptr, align 4
1024 // CHECK3-NEXT: store ptr [[T_VAR]], ptr [[T_VAR_ADDR]], align 4
1025 // CHECK3-NEXT: [[TMP0:%.*]] = load ptr, ptr [[T_VAR_ADDR]], align 4
1026 // CHECK3-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB4]], i32 1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined, ptr [[TMP0]])
1027 // CHECK3-NEXT: ret void
1030 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined
1031 // CHECK3-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[T_VAR:%.*]]) #[[ATTR1]] {
1032 // CHECK3-NEXT: entry:
1033 // CHECK3-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 4
1034 // CHECK3-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 4
1035 // CHECK3-NEXT: [[T_VAR_ADDR:%.*]] = alloca ptr, align 4
1036 // CHECK3-NEXT: [[T_VAR1:%.*]] = alloca i32, align 4
1037 // CHECK3-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
1038 // CHECK3-NEXT: [[TMP:%.*]] = alloca i32, align 4
1039 // CHECK3-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
1040 // CHECK3-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
1041 // CHECK3-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
1042 // CHECK3-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
1043 // CHECK3-NEXT: [[I:%.*]] = alloca i32, align 4
1044 // CHECK3-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 4
1045 // CHECK3-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 4
1046 // CHECK3-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 4
1047 // CHECK3-NEXT: store ptr [[T_VAR]], ptr [[T_VAR_ADDR]], align 4
1048 // CHECK3-NEXT: [[TMP0:%.*]] = load ptr, ptr [[T_VAR_ADDR]], align 4
1049 // CHECK3-NEXT: store i32 0, ptr [[T_VAR1]], align 4
1050 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
1051 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_COMB_UB]], align 4
1052 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
1053 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
1054 // CHECK3-NEXT: [[TMP1:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 4
1055 // CHECK3-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP1]], align 4
1056 // CHECK3-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1]], i32 [[TMP2]], i32 92, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_COMB_LB]], ptr [[DOTOMP_COMB_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
1057 // CHECK3-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1058 // CHECK3-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP3]], 1
1059 // CHECK3-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
1060 // CHECK3: cond.true:
1061 // CHECK3-NEXT: br label [[COND_END:%.*]]
1062 // CHECK3: cond.false:
1063 // CHECK3-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1064 // CHECK3-NEXT: br label [[COND_END]]
1065 // CHECK3: cond.end:
1066 // CHECK3-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP4]], [[COND_FALSE]] ]
1067 // CHECK3-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
1068 // CHECK3-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
1069 // CHECK3-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_IV]], align 4
1070 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
1071 // CHECK3: omp.inner.for.cond:
1072 // CHECK3-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1073 // CHECK3-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1074 // CHECK3-NEXT: [[CMP2:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
1075 // CHECK3-NEXT: br i1 [[CMP2]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
1076 // CHECK3: omp.inner.for.body:
1077 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
1078 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1079 // CHECK3-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB4]], i32 3, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined.omp_outlined, i32 [[TMP8]], i32 [[TMP9]], ptr [[T_VAR1]])
1080 // CHECK3-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
1081 // CHECK3: omp.inner.for.inc:
1082 // CHECK3-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1083 // CHECK3-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_STRIDE]], align 4
1084 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP10]], [[TMP11]]
1085 // CHECK3-NEXT: store i32 [[ADD]], ptr [[DOTOMP_IV]], align 4
1086 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND]]
1087 // CHECK3: omp.inner.for.end:
1088 // CHECK3-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
1089 // CHECK3: omp.loop.exit:
1090 // CHECK3-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP2]])
1091 // CHECK3-NEXT: [[TMP12:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i32 0, i32 0
1092 // CHECK3-NEXT: store ptr [[T_VAR1]], ptr [[TMP12]], align 4
1093 // CHECK3-NEXT: [[TMP13:%.*]] = call i32 @__kmpc_reduce_nowait(ptr @[[GLOB3]], 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)
1094 // CHECK3-NEXT: switch i32 [[TMP13]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
1095 // CHECK3-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
1096 // CHECK3-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
1098 // CHECK3: .omp.reduction.case1:
1099 // CHECK3-NEXT: [[TMP14:%.*]] = load i32, ptr [[TMP0]], align 4
1100 // CHECK3-NEXT: [[TMP15:%.*]] = load i32, ptr [[T_VAR1]], align 4
1101 // CHECK3-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP14]], [[TMP15]]
1102 // CHECK3-NEXT: store i32 [[ADD3]], ptr [[TMP0]], align 4
1103 // CHECK3-NEXT: call void @__kmpc_end_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP2]], ptr @.gomp_critical_user_.reduction.var)
1104 // CHECK3-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
1105 // CHECK3: .omp.reduction.case2:
1106 // CHECK3-NEXT: [[TMP16:%.*]] = load i32, ptr [[T_VAR1]], align 4
1107 // CHECK3-NEXT: [[TMP17:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP16]] monotonic, align 4
1108 // CHECK3-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
1109 // CHECK3: .omp.reduction.default:
1110 // CHECK3-NEXT: ret void
1113 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined.omp_outlined
1114 // CHECK3-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], i32 noundef [[DOTPREVIOUS_LB_:%.*]], i32 noundef [[DOTPREVIOUS_UB_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[T_VAR:%.*]]) #[[ATTR1]] {
1115 // CHECK3-NEXT: entry:
1116 // CHECK3-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 4
1117 // CHECK3-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 4
1118 // CHECK3-NEXT: [[DOTPREVIOUS_LB__ADDR:%.*]] = alloca i32, align 4
1119 // CHECK3-NEXT: [[DOTPREVIOUS_UB__ADDR:%.*]] = alloca i32, align 4
1120 // CHECK3-NEXT: [[T_VAR_ADDR:%.*]] = alloca ptr, align 4
1121 // CHECK3-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
1122 // CHECK3-NEXT: [[TMP:%.*]] = alloca i32, align 4
1123 // CHECK3-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
1124 // CHECK3-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
1125 // CHECK3-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
1126 // CHECK3-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
1127 // CHECK3-NEXT: [[T_VAR1:%.*]] = alloca i32, align 4
1128 // CHECK3-NEXT: [[I:%.*]] = alloca i32, align 4
1129 // CHECK3-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 4
1130 // CHECK3-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 4
1131 // CHECK3-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 4
1132 // CHECK3-NEXT: store i32 [[DOTPREVIOUS_LB_]], ptr [[DOTPREVIOUS_LB__ADDR]], align 4
1133 // CHECK3-NEXT: store i32 [[DOTPREVIOUS_UB_]], ptr [[DOTPREVIOUS_UB__ADDR]], align 4
1134 // CHECK3-NEXT: store ptr [[T_VAR]], ptr [[T_VAR_ADDR]], align 4
1135 // CHECK3-NEXT: [[TMP0:%.*]] = load ptr, ptr [[T_VAR_ADDR]], align 4
1136 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
1137 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_UB]], align 4
1138 // CHECK3-NEXT: [[TMP1:%.*]] = load i32, ptr [[DOTPREVIOUS_LB__ADDR]], align 4
1139 // CHECK3-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTPREVIOUS_UB__ADDR]], align 4
1140 // CHECK3-NEXT: store i32 [[TMP1]], ptr [[DOTOMP_LB]], align 4
1141 // CHECK3-NEXT: store i32 [[TMP2]], ptr [[DOTOMP_UB]], align 4
1142 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
1143 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
1144 // CHECK3-NEXT: store i32 0, ptr [[T_VAR1]], align 4
1145 // CHECK3-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 4
1146 // CHECK3-NEXT: [[TMP4:%.*]] = load i32, ptr [[TMP3]], align 4
1147 // CHECK3-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB2]], i32 [[TMP4]], i32 34, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_LB]], ptr [[DOTOMP_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
1148 // CHECK3-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
1149 // CHECK3-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP5]], 1
1150 // CHECK3-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
1151 // CHECK3: cond.true:
1152 // CHECK3-NEXT: br label [[COND_END:%.*]]
1153 // CHECK3: cond.false:
1154 // CHECK3-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
1155 // CHECK3-NEXT: br label [[COND_END]]
1156 // CHECK3: cond.end:
1157 // CHECK3-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP6]], [[COND_FALSE]] ]
1158 // CHECK3-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
1159 // CHECK3-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
1160 // CHECK3-NEXT: store i32 [[TMP7]], ptr [[DOTOMP_IV]], align 4
1161 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
1162 // CHECK3: omp.inner.for.cond:
1163 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1164 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
1165 // CHECK3-NEXT: [[CMP2:%.*]] = icmp sle i32 [[TMP8]], [[TMP9]]
1166 // CHECK3-NEXT: br i1 [[CMP2]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
1167 // CHECK3: omp.inner.for.body:
1168 // CHECK3-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1169 // CHECK3-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP10]], 1
1170 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
1171 // CHECK3-NEXT: store i32 [[ADD]], ptr [[I]], align 4
1172 // CHECK3-NEXT: [[TMP11:%.*]] = load i32, ptr [[I]], align 4
1173 // CHECK3-NEXT: [[TMP12:%.*]] = load i32, ptr [[T_VAR1]], align 4
1174 // CHECK3-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP12]], [[TMP11]]
1175 // CHECK3-NEXT: store i32 [[ADD3]], ptr [[T_VAR1]], align 4
1176 // CHECK3-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
1177 // CHECK3: omp.body.continue:
1178 // CHECK3-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
1179 // CHECK3: omp.inner.for.inc:
1180 // CHECK3-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1181 // CHECK3-NEXT: [[ADD4:%.*]] = add nsw i32 [[TMP13]], 1
1182 // CHECK3-NEXT: store i32 [[ADD4]], ptr [[DOTOMP_IV]], align 4
1183 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND]]
1184 // CHECK3: omp.inner.for.end:
1185 // CHECK3-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
1186 // CHECK3: omp.loop.exit:
1187 // CHECK3-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP4]])
1188 // CHECK3-NEXT: [[TMP14:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i32 0, i32 0
1189 // CHECK3-NEXT: store ptr [[T_VAR1]], ptr [[TMP14]], align 4
1190 // CHECK3-NEXT: [[TMP15:%.*]] = call i32 @__kmpc_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP4]], i32 1, i32 4, ptr [[DOTOMP_REDUCTION_RED_LIST]], ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined.omp_outlined.omp.reduction.reduction_func, ptr @.gomp_critical_user_.reduction.var)
1191 // CHECK3-NEXT: switch i32 [[TMP15]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
1192 // CHECK3-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
1193 // CHECK3-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
1195 // CHECK3: .omp.reduction.case1:
1196 // CHECK3-NEXT: [[TMP16:%.*]] = load i32, ptr [[TMP0]], align 4
1197 // CHECK3-NEXT: [[TMP17:%.*]] = load i32, ptr [[T_VAR1]], align 4
1198 // CHECK3-NEXT: [[ADD5:%.*]] = add nsw i32 [[TMP16]], [[TMP17]]
1199 // CHECK3-NEXT: store i32 [[ADD5]], ptr [[TMP0]], align 4
1200 // CHECK3-NEXT: call void @__kmpc_end_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP4]], ptr @.gomp_critical_user_.reduction.var)
1201 // CHECK3-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
1202 // CHECK3: .omp.reduction.case2:
1203 // CHECK3-NEXT: [[TMP18:%.*]] = load i32, ptr [[T_VAR1]], align 4
1204 // CHECK3-NEXT: [[TMP19:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP18]] monotonic, align 4
1205 // CHECK3-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
1206 // CHECK3: .omp.reduction.default:
1207 // CHECK3-NEXT: ret void
1210 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined.omp_outlined.omp.reduction.reduction_func
1211 // CHECK3-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR3]] {
1212 // CHECK3-NEXT: entry:
1213 // CHECK3-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 4
1214 // CHECK3-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 4
1215 // CHECK3-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 4
1216 // CHECK3-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 4
1217 // CHECK3-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 4
1218 // CHECK3-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 4
1219 // CHECK3-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i32 0, i32 0
1220 // CHECK3-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 4
1221 // CHECK3-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i32 0, i32 0
1222 // CHECK3-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 4
1223 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
1224 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
1225 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
1226 // CHECK3-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
1227 // CHECK3-NEXT: ret void
1230 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined.omp.reduction.reduction_func
1231 // CHECK3-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR3]] {
1232 // CHECK3-NEXT: entry:
1233 // CHECK3-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 4
1234 // CHECK3-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 4
1235 // CHECK3-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 4
1236 // CHECK3-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 4
1237 // CHECK3-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 4
1238 // CHECK3-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 4
1239 // CHECK3-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i32 0, i32 0
1240 // CHECK3-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 4
1241 // CHECK3-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i32 0, i32 0
1242 // CHECK3-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 4
1243 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
1244 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
1245 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
1246 // CHECK3-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
1247 // CHECK3-NEXT: ret void
1250 // CHECK3-LABEL: define {{[^@]+}}@.omp_offloading.requires_reg
1251 // CHECK3-SAME: () #[[ATTR7:[0-9]+]] {
1252 // CHECK3-NEXT: entry:
1253 // CHECK3-NEXT: call void @__tgt_register_requires(i64 1)
1254 // CHECK3-NEXT: ret void
1257 // CHECK5-LABEL: define {{[^@]+}}@main
1258 // CHECK5-SAME: () #[[ATTR0:[0-9]+]] {
1259 // CHECK5-NEXT: entry:
1260 // CHECK5-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
1261 // CHECK5-NEXT: [[REF_TMP:%.*]] = alloca [[CLASS_ANON:%.*]], align 1
1262 // CHECK5-NEXT: store i32 0, ptr [[RETVAL]], align 4
1263 // CHECK5-NEXT: call void @"_ZZ4mainENK3$_0clEv"(ptr noundef nonnull align 1 dereferenceable(1) [[REF_TMP]])
1264 // CHECK5-NEXT: ret i32 0
1267 // CHECK5-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l44
1268 // CHECK5-SAME: (ptr noundef nonnull align 4 dereferenceable(4) [[SIVAR:%.*]]) #[[ATTR2:[0-9]+]] {
1269 // CHECK5-NEXT: entry:
1270 // CHECK5-NEXT: [[SIVAR_ADDR:%.*]] = alloca ptr, align 8
1271 // CHECK5-NEXT: store ptr [[SIVAR]], ptr [[SIVAR_ADDR]], align 8
1272 // CHECK5-NEXT: [[TMP0:%.*]] = load ptr, ptr [[SIVAR_ADDR]], align 8
1273 // CHECK5-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB4:[0-9]+]], i32 1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l44.omp_outlined, ptr [[TMP0]])
1274 // CHECK5-NEXT: ret void
1277 // CHECK5-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l44.omp_outlined
1278 // CHECK5-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[SIVAR:%.*]]) #[[ATTR2]] {
1279 // CHECK5-NEXT: entry:
1280 // CHECK5-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
1281 // CHECK5-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
1282 // CHECK5-NEXT: [[SIVAR_ADDR:%.*]] = alloca ptr, align 8
1283 // CHECK5-NEXT: [[SIVAR1:%.*]] = alloca i32, align 4
1284 // CHECK5-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
1285 // CHECK5-NEXT: [[TMP:%.*]] = alloca i32, align 4
1286 // CHECK5-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
1287 // CHECK5-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
1288 // CHECK5-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
1289 // CHECK5-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
1290 // CHECK5-NEXT: [[I:%.*]] = alloca i32, align 4
1291 // CHECK5-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 8
1292 // CHECK5-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
1293 // CHECK5-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
1294 // CHECK5-NEXT: store ptr [[SIVAR]], ptr [[SIVAR_ADDR]], align 8
1295 // CHECK5-NEXT: [[TMP0:%.*]] = load ptr, ptr [[SIVAR_ADDR]], align 8
1296 // CHECK5-NEXT: store i32 0, ptr [[SIVAR1]], align 4
1297 // CHECK5-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
1298 // CHECK5-NEXT: store i32 1, ptr [[DOTOMP_COMB_UB]], align 4
1299 // CHECK5-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
1300 // CHECK5-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
1301 // CHECK5-NEXT: [[TMP1:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
1302 // CHECK5-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP1]], align 4
1303 // CHECK5-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1:[0-9]+]], i32 [[TMP2]], i32 92, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_COMB_LB]], ptr [[DOTOMP_COMB_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
1304 // CHECK5-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1305 // CHECK5-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP3]], 1
1306 // CHECK5-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
1307 // CHECK5: cond.true:
1308 // CHECK5-NEXT: br label [[COND_END:%.*]]
1309 // CHECK5: cond.false:
1310 // CHECK5-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1311 // CHECK5-NEXT: br label [[COND_END]]
1312 // CHECK5: cond.end:
1313 // CHECK5-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP4]], [[COND_FALSE]] ]
1314 // CHECK5-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
1315 // CHECK5-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
1316 // CHECK5-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_IV]], align 4
1317 // CHECK5-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
1318 // CHECK5: omp.inner.for.cond:
1319 // CHECK5-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1320 // CHECK5-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1321 // CHECK5-NEXT: [[CMP2:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
1322 // CHECK5-NEXT: br i1 [[CMP2]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
1323 // CHECK5: omp.inner.for.body:
1324 // CHECK5-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
1325 // CHECK5-NEXT: [[TMP9:%.*]] = zext i32 [[TMP8]] to i64
1326 // CHECK5-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1327 // CHECK5-NEXT: [[TMP11:%.*]] = zext i32 [[TMP10]] to i64
1328 // CHECK5-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB4]], i32 3, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l44.omp_outlined.omp_outlined, i64 [[TMP9]], i64 [[TMP11]], ptr [[SIVAR1]])
1329 // CHECK5-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
1330 // CHECK5: omp.inner.for.inc:
1331 // CHECK5-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1332 // CHECK5-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_STRIDE]], align 4
1333 // CHECK5-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP12]], [[TMP13]]
1334 // CHECK5-NEXT: store i32 [[ADD]], ptr [[DOTOMP_IV]], align 4
1335 // CHECK5-NEXT: br label [[OMP_INNER_FOR_COND]]
1336 // CHECK5: omp.inner.for.end:
1337 // CHECK5-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
1338 // CHECK5: omp.loop.exit:
1339 // CHECK5-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP2]])
1340 // CHECK5-NEXT: [[TMP14:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i64 0, i64 0
1341 // CHECK5-NEXT: store ptr [[SIVAR1]], ptr [[TMP14]], align 8
1342 // CHECK5-NEXT: [[TMP15:%.*]] = call i32 @__kmpc_reduce_nowait(ptr @[[GLOB3:[0-9]+]], i32 [[TMP2]], i32 1, i64 8, ptr [[DOTOMP_REDUCTION_RED_LIST]], ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l44.omp_outlined.omp.reduction.reduction_func, ptr @.gomp_critical_user_.reduction.var)
1343 // CHECK5-NEXT: switch i32 [[TMP15]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
1344 // CHECK5-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
1345 // CHECK5-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
1347 // CHECK5: .omp.reduction.case1:
1348 // CHECK5-NEXT: [[TMP16:%.*]] = load i32, ptr [[TMP0]], align 4
1349 // CHECK5-NEXT: [[TMP17:%.*]] = load i32, ptr [[SIVAR1]], align 4
1350 // CHECK5-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP16]], [[TMP17]]
1351 // CHECK5-NEXT: store i32 [[ADD3]], ptr [[TMP0]], align 4
1352 // CHECK5-NEXT: call void @__kmpc_end_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP2]], ptr @.gomp_critical_user_.reduction.var)
1353 // CHECK5-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
1354 // CHECK5: .omp.reduction.case2:
1355 // CHECK5-NEXT: [[TMP18:%.*]] = load i32, ptr [[SIVAR1]], align 4
1356 // CHECK5-NEXT: [[TMP19:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP18]] monotonic, align 4
1357 // CHECK5-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
1358 // CHECK5: .omp.reduction.default:
1359 // CHECK5-NEXT: ret void
1362 // CHECK5-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l44.omp_outlined.omp_outlined
1363 // CHECK5-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], i64 noundef [[DOTPREVIOUS_LB_:%.*]], i64 noundef [[DOTPREVIOUS_UB_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[SIVAR:%.*]]) #[[ATTR2]] {
1364 // CHECK5-NEXT: entry:
1365 // CHECK5-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
1366 // CHECK5-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
1367 // CHECK5-NEXT: [[DOTPREVIOUS_LB__ADDR:%.*]] = alloca i64, align 8
1368 // CHECK5-NEXT: [[DOTPREVIOUS_UB__ADDR:%.*]] = alloca i64, align 8
1369 // CHECK5-NEXT: [[SIVAR_ADDR:%.*]] = alloca ptr, align 8
1370 // CHECK5-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
1371 // CHECK5-NEXT: [[TMP:%.*]] = alloca i32, align 4
1372 // CHECK5-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
1373 // CHECK5-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
1374 // CHECK5-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
1375 // CHECK5-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
1376 // CHECK5-NEXT: [[SIVAR2:%.*]] = alloca i32, align 4
1377 // CHECK5-NEXT: [[I:%.*]] = alloca i32, align 4
1378 // CHECK5-NEXT: [[REF_TMP:%.*]] = alloca [[CLASS_ANON_0:%.*]], align 8
1379 // CHECK5-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 8
1380 // CHECK5-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
1381 // CHECK5-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
1382 // CHECK5-NEXT: store i64 [[DOTPREVIOUS_LB_]], ptr [[DOTPREVIOUS_LB__ADDR]], align 8
1383 // CHECK5-NEXT: store i64 [[DOTPREVIOUS_UB_]], ptr [[DOTPREVIOUS_UB__ADDR]], align 8
1384 // CHECK5-NEXT: store ptr [[SIVAR]], ptr [[SIVAR_ADDR]], align 8
1385 // CHECK5-NEXT: [[TMP0:%.*]] = load ptr, ptr [[SIVAR_ADDR]], align 8
1386 // CHECK5-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
1387 // CHECK5-NEXT: store i32 1, ptr [[DOTOMP_UB]], align 4
1388 // CHECK5-NEXT: [[TMP1:%.*]] = load i64, ptr [[DOTPREVIOUS_LB__ADDR]], align 8
1389 // CHECK5-NEXT: [[CONV:%.*]] = trunc i64 [[TMP1]] to i32
1390 // CHECK5-NEXT: [[TMP2:%.*]] = load i64, ptr [[DOTPREVIOUS_UB__ADDR]], align 8
1391 // CHECK5-NEXT: [[CONV1:%.*]] = trunc i64 [[TMP2]] to i32
1392 // CHECK5-NEXT: store i32 [[CONV]], ptr [[DOTOMP_LB]], align 4
1393 // CHECK5-NEXT: store i32 [[CONV1]], ptr [[DOTOMP_UB]], align 4
1394 // CHECK5-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
1395 // CHECK5-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
1396 // CHECK5-NEXT: store i32 0, ptr [[SIVAR2]], align 4
1397 // CHECK5-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
1398 // CHECK5-NEXT: [[TMP4:%.*]] = load i32, ptr [[TMP3]], align 4
1399 // CHECK5-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB2:[0-9]+]], i32 [[TMP4]], i32 34, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_LB]], ptr [[DOTOMP_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
1400 // CHECK5-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
1401 // CHECK5-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP5]], 1
1402 // CHECK5-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
1403 // CHECK5: cond.true:
1404 // CHECK5-NEXT: br label [[COND_END:%.*]]
1405 // CHECK5: cond.false:
1406 // CHECK5-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
1407 // CHECK5-NEXT: br label [[COND_END]]
1408 // CHECK5: cond.end:
1409 // CHECK5-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP6]], [[COND_FALSE]] ]
1410 // CHECK5-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
1411 // CHECK5-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
1412 // CHECK5-NEXT: store i32 [[TMP7]], ptr [[DOTOMP_IV]], align 4
1413 // CHECK5-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
1414 // CHECK5: omp.inner.for.cond:
1415 // CHECK5-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1416 // CHECK5-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
1417 // CHECK5-NEXT: [[CMP3:%.*]] = icmp sle i32 [[TMP8]], [[TMP9]]
1418 // CHECK5-NEXT: br i1 [[CMP3]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
1419 // CHECK5: omp.inner.for.body:
1420 // CHECK5-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1421 // CHECK5-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP10]], 1
1422 // CHECK5-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
1423 // CHECK5-NEXT: store i32 [[ADD]], ptr [[I]], align 4
1424 // CHECK5-NEXT: [[TMP11:%.*]] = load i32, ptr [[I]], align 4
1425 // CHECK5-NEXT: [[TMP12:%.*]] = load i32, ptr [[SIVAR2]], align 4
1426 // CHECK5-NEXT: [[ADD4:%.*]] = add nsw i32 [[TMP12]], [[TMP11]]
1427 // CHECK5-NEXT: store i32 [[ADD4]], ptr [[SIVAR2]], align 4
1428 // CHECK5-NEXT: [[TMP13:%.*]] = getelementptr inbounds [[CLASS_ANON_0]], ptr [[REF_TMP]], i32 0, i32 0
1429 // CHECK5-NEXT: store ptr [[SIVAR2]], ptr [[TMP13]], align 8
1430 // CHECK5-NEXT: call void @"_ZZZ4mainENK3$_0clEvENKUlvE_clEv"(ptr noundef nonnull align 8 dereferenceable(8) [[REF_TMP]])
1431 // CHECK5-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
1432 // CHECK5: omp.body.continue:
1433 // CHECK5-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
1434 // CHECK5: omp.inner.for.inc:
1435 // CHECK5-NEXT: [[TMP14:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1436 // CHECK5-NEXT: [[ADD5:%.*]] = add nsw i32 [[TMP14]], 1
1437 // CHECK5-NEXT: store i32 [[ADD5]], ptr [[DOTOMP_IV]], align 4
1438 // CHECK5-NEXT: br label [[OMP_INNER_FOR_COND]]
1439 // CHECK5: omp.inner.for.end:
1440 // CHECK5-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
1441 // CHECK5: omp.loop.exit:
1442 // CHECK5-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP4]])
1443 // CHECK5-NEXT: [[TMP15:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i64 0, i64 0
1444 // CHECK5-NEXT: store ptr [[SIVAR2]], ptr [[TMP15]], align 8
1445 // CHECK5-NEXT: [[TMP16:%.*]] = call i32 @__kmpc_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP4]], i32 1, i64 8, ptr [[DOTOMP_REDUCTION_RED_LIST]], ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l44.omp_outlined.omp_outlined.omp.reduction.reduction_func, ptr @.gomp_critical_user_.reduction.var)
1446 // CHECK5-NEXT: switch i32 [[TMP16]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
1447 // CHECK5-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
1448 // CHECK5-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
1450 // CHECK5: .omp.reduction.case1:
1451 // CHECK5-NEXT: [[TMP17:%.*]] = load i32, ptr [[TMP0]], align 4
1452 // CHECK5-NEXT: [[TMP18:%.*]] = load i32, ptr [[SIVAR2]], align 4
1453 // CHECK5-NEXT: [[ADD6:%.*]] = add nsw i32 [[TMP17]], [[TMP18]]
1454 // CHECK5-NEXT: store i32 [[ADD6]], ptr [[TMP0]], align 4
1455 // CHECK5-NEXT: call void @__kmpc_end_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP4]], ptr @.gomp_critical_user_.reduction.var)
1456 // CHECK5-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
1457 // CHECK5: .omp.reduction.case2:
1458 // CHECK5-NEXT: [[TMP19:%.*]] = load i32, ptr [[SIVAR2]], align 4
1459 // CHECK5-NEXT: [[TMP20:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP19]] monotonic, align 4
1460 // CHECK5-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
1461 // CHECK5: .omp.reduction.default:
1462 // CHECK5-NEXT: ret void
1465 // CHECK5-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l44.omp_outlined.omp_outlined.omp.reduction.reduction_func
1466 // CHECK5-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR4:[0-9]+]] {
1467 // CHECK5-NEXT: entry:
1468 // CHECK5-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 8
1469 // CHECK5-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 8
1470 // CHECK5-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 8
1471 // CHECK5-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 8
1472 // CHECK5-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 8
1473 // CHECK5-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 8
1474 // CHECK5-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i64 0, i64 0
1475 // CHECK5-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 8
1476 // CHECK5-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i64 0, i64 0
1477 // CHECK5-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 8
1478 // CHECK5-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
1479 // CHECK5-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
1480 // CHECK5-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
1481 // CHECK5-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
1482 // CHECK5-NEXT: ret void
1485 // CHECK5-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l44.omp_outlined.omp.reduction.reduction_func
1486 // CHECK5-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR4]] {
1487 // CHECK5-NEXT: entry:
1488 // CHECK5-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 8
1489 // CHECK5-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 8
1490 // CHECK5-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 8
1491 // CHECK5-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 8
1492 // CHECK5-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 8
1493 // CHECK5-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 8
1494 // CHECK5-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i64 0, i64 0
1495 // CHECK5-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 8
1496 // CHECK5-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i64 0, i64 0
1497 // CHECK5-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 8
1498 // CHECK5-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
1499 // CHECK5-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
1500 // CHECK5-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
1501 // CHECK5-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
1502 // CHECK5-NEXT: ret void
1505 // CHECK5-LABEL: define {{[^@]+}}@.omp_offloading.requires_reg
1506 // CHECK5-SAME: () #[[ATTR6:[0-9]+]] {
1507 // CHECK5-NEXT: entry:
1508 // CHECK5-NEXT: call void @__tgt_register_requires(i64 1)
1509 // CHECK5-NEXT: ret void