Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / teams_distribute_parallel_for_simd_reduction_codegen.cpp
blob22671b48c3552ba431aa394103d2a9a126bc2e1e
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --include-generated-funcs --replace-value-regex "__omp_offloading_[0-9a-z]+_[0-9a-z]+" "reduction_size[.].+[.]" "pl_cond[.].+[.|,]" --prefix-filecheck-ir-name _
2 // RUN: %clang_cc1 -DCHECK -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK1
3 // RUN: %clang_cc1 -DCHECK -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
4 // RUN: %clang_cc1 -DCHECK -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK1
5 // RUN: %clang_cc1 -DCHECK -verify -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK3
6 // RUN: %clang_cc1 -DCHECK -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -o %t %s
7 // RUN: %clang_cc1 -DCHECK -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK3
9 // RUN: %clang_cc1 -DCHECK -verify -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK5
10 // RUN: %clang_cc1 -DCHECK -fopenmp-simd -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
11 // RUN: %clang_cc1 -DCHECK -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK5
12 // RUN: %clang_cc1 -DCHECK -verify -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK7
13 // RUN: %clang_cc1 -DCHECK -fopenmp-simd -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -o %t %s
14 // RUN: %clang_cc1 -DCHECK -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK7
16 // RUN: %clang_cc1 -DLAMBDA -verify -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK9
17 // RUN: %clang_cc1 -DLAMBDA -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
18 // RUN: %clang_cc1 -DLAMBDA -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK9
20 // RUN: %clang_cc1 -DLAMBDA -verify -fopenmp-simd -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK11
21 // RUN: %clang_cc1 -DLAMBDA -fopenmp-simd -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
22 // RUN: %clang_cc1 -DLAMBDA -fopenmp-simd -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK11
24 // expected-no-diagnostics
25 #ifndef HEADER
26 #define HEADER
28 template <typename T>
29 T tmain() {
30 T t_var = T();
31 T vec[] = {1, 2};
32 #pragma omp target
33 #pragma omp teams distribute parallel for simd reduction(+: t_var)
34 for (int i = 0; i < 2; ++i) {
35 t_var += (T) i;
37 return T();
40 int main() {
41 static int sivar;
42 #ifdef LAMBDA
44 [&]() {
45 #pragma omp target
46 #pragma omp teams distribute parallel for simd reduction(+: sivar)
47 for (int i = 0; i < 2; ++i) {
49 // Skip global and bound tid vars
53 // Skip global and bound tid vars, and prev lb and ub vars
54 // skip loop vars
57 sivar += i;
59 [&]() {
61 sivar += 4;
63 }();
65 }();
66 return 0;
69 #else
70 #pragma omp target
71 #pragma omp teams distribute parallel for simd reduction(+: sivar)
72 for (int i = 0; i < 2; ++i) {
73 sivar += i;
75 return tmain<int>();
76 #endif
82 // Skip global and bound tid vars
85 // Skip global and bound tid vars, and prev lb and ub
86 // skip loop vars
91 // Skip global and bound tid vars
94 // Skip global and bound tid vars, and prev lb and ub vars
95 // skip loop vars
99 #endif
100 // CHECK1-LABEL: define {{[^@]+}}@main
101 // CHECK1-SAME: () #[[ATTR0:[0-9]+]] {
102 // CHECK1-NEXT: entry:
103 // CHECK1-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
104 // CHECK1-NEXT: [[SIVAR_CASTED:%.*]] = alloca i64, align 8
105 // CHECK1-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [1 x ptr], align 8
106 // CHECK1-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [1 x ptr], align 8
107 // CHECK1-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [1 x ptr], align 8
108 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
109 // CHECK1-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
110 // CHECK1-NEXT: store i32 0, ptr [[RETVAL]], align 4
111 // CHECK1-NEXT: [[TMP0:%.*]] = load i32, ptr @_ZZ4mainE5sivar, align 4
112 // CHECK1-NEXT: store i32 [[TMP0]], ptr [[SIVAR_CASTED]], align 4
113 // CHECK1-NEXT: [[TMP1:%.*]] = load i64, ptr [[SIVAR_CASTED]], align 8
114 // CHECK1-NEXT: [[TMP2:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
115 // CHECK1-NEXT: store i64 [[TMP1]], ptr [[TMP2]], align 8
116 // CHECK1-NEXT: [[TMP3:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
117 // CHECK1-NEXT: store i64 [[TMP1]], ptr [[TMP3]], align 8
118 // CHECK1-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 0
119 // CHECK1-NEXT: store ptr null, ptr [[TMP4]], align 8
120 // CHECK1-NEXT: [[TMP5:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
121 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
122 // CHECK1-NEXT: [[TMP7:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
123 // CHECK1-NEXT: store i32 2, ptr [[TMP7]], align 4
124 // CHECK1-NEXT: [[TMP8:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
125 // CHECK1-NEXT: store i32 1, ptr [[TMP8]], align 4
126 // CHECK1-NEXT: [[TMP9:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
127 // CHECK1-NEXT: store ptr [[TMP5]], ptr [[TMP9]], align 8
128 // CHECK1-NEXT: [[TMP10:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
129 // CHECK1-NEXT: store ptr [[TMP6]], ptr [[TMP10]], align 8
130 // CHECK1-NEXT: [[TMP11:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
131 // CHECK1-NEXT: store ptr @.offload_sizes, ptr [[TMP11]], align 8
132 // CHECK1-NEXT: [[TMP12:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
133 // CHECK1-NEXT: store ptr @.offload_maptypes, ptr [[TMP12]], align 8
134 // CHECK1-NEXT: [[TMP13:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
135 // CHECK1-NEXT: store ptr null, ptr [[TMP13]], align 8
136 // CHECK1-NEXT: [[TMP14:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
137 // CHECK1-NEXT: store ptr null, ptr [[TMP14]], align 8
138 // CHECK1-NEXT: [[TMP15:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
139 // CHECK1-NEXT: store i64 2, ptr [[TMP15]], align 8
140 // CHECK1-NEXT: [[TMP16:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
141 // CHECK1-NEXT: store i64 0, ptr [[TMP16]], align 8
142 // CHECK1-NEXT: [[TMP17:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
143 // CHECK1-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP17]], align 4
144 // CHECK1-NEXT: [[TMP18:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
145 // CHECK1-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP18]], align 4
146 // CHECK1-NEXT: [[TMP19:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
147 // CHECK1-NEXT: store i32 0, ptr [[TMP19]], align 4
148 // CHECK1-NEXT: [[TMP20:%.*]] = 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_l70.region_id, ptr [[KERNEL_ARGS]])
149 // CHECK1-NEXT: [[TMP21:%.*]] = icmp ne i32 [[TMP20]], 0
150 // CHECK1-NEXT: br i1 [[TMP21]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
151 // CHECK1: omp_offload.failed:
152 // CHECK1-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l70(i64 [[TMP1]]) #[[ATTR3:[0-9]+]]
153 // CHECK1-NEXT: br label [[OMP_OFFLOAD_CONT]]
154 // CHECK1: omp_offload.cont:
155 // CHECK1-NEXT: [[CALL:%.*]] = call noundef signext i32 @_Z5tmainIiET_v()
156 // CHECK1-NEXT: ret i32 [[CALL]]
159 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l70
160 // CHECK1-SAME: (i64 noundef [[SIVAR:%.*]]) #[[ATTR1:[0-9]+]] {
161 // CHECK1-NEXT: entry:
162 // CHECK1-NEXT: [[SIVAR_ADDR:%.*]] = alloca i64, align 8
163 // CHECK1-NEXT: store i64 [[SIVAR]], ptr [[SIVAR_ADDR]], align 8
164 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB4]], i32 1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l70.omp_outlined, ptr [[SIVAR_ADDR]])
165 // CHECK1-NEXT: ret void
168 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l70.omp_outlined
169 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[SIVAR:%.*]]) #[[ATTR2:[0-9]+]] {
170 // CHECK1-NEXT: entry:
171 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
172 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
173 // CHECK1-NEXT: [[SIVAR_ADDR:%.*]] = alloca ptr, align 8
174 // CHECK1-NEXT: [[SIVAR1:%.*]] = alloca i32, align 4
175 // CHECK1-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
176 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
177 // CHECK1-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
178 // CHECK1-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
179 // CHECK1-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
180 // CHECK1-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
181 // CHECK1-NEXT: [[I:%.*]] = alloca i32, align 4
182 // CHECK1-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 8
183 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
184 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
185 // CHECK1-NEXT: store ptr [[SIVAR]], ptr [[SIVAR_ADDR]], align 8
186 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[SIVAR_ADDR]], align 8
187 // CHECK1-NEXT: store i32 0, ptr [[SIVAR1]], align 4
188 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
189 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_COMB_UB]], align 4
190 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
191 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
192 // CHECK1-NEXT: [[TMP1:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
193 // CHECK1-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP1]], align 4
194 // 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)
195 // CHECK1-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
196 // CHECK1-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP3]], 1
197 // CHECK1-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
198 // CHECK1: cond.true:
199 // CHECK1-NEXT: br label [[COND_END:%.*]]
200 // CHECK1: cond.false:
201 // CHECK1-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
202 // CHECK1-NEXT: br label [[COND_END]]
203 // CHECK1: cond.end:
204 // CHECK1-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP4]], [[COND_FALSE]] ]
205 // CHECK1-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
206 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
207 // CHECK1-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_IV]], align 4
208 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
209 // CHECK1: omp.inner.for.cond:
210 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP5:![0-9]+]]
211 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4, !llvm.access.group [[ACC_GRP5]]
212 // CHECK1-NEXT: [[CMP2:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
213 // CHECK1-NEXT: br i1 [[CMP2]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
214 // CHECK1: omp.inner.for.body:
215 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4, !llvm.access.group [[ACC_GRP5]]
216 // CHECK1-NEXT: [[TMP9:%.*]] = zext i32 [[TMP8]] to i64
217 // CHECK1-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4, !llvm.access.group [[ACC_GRP5]]
218 // CHECK1-NEXT: [[TMP11:%.*]] = zext i32 [[TMP10]] to i64
219 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB4]], i32 3, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l70.omp_outlined.omp_outlined, i64 [[TMP9]], i64 [[TMP11]], ptr [[SIVAR1]]), !llvm.access.group [[ACC_GRP5]]
220 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
221 // CHECK1: omp.inner.for.inc:
222 // CHECK1-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP5]]
223 // CHECK1-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_STRIDE]], align 4, !llvm.access.group [[ACC_GRP5]]
224 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP12]], [[TMP13]]
225 // CHECK1-NEXT: store i32 [[ADD]], ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP5]]
226 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]], !llvm.loop [[LOOP6:![0-9]+]]
227 // CHECK1: omp.inner.for.end:
228 // CHECK1-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
229 // CHECK1: omp.loop.exit:
230 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP2]])
231 // CHECK1-NEXT: [[TMP14:%.*]] = load i32, ptr [[DOTOMP_IS_LAST]], align 4
232 // CHECK1-NEXT: [[TMP15:%.*]] = icmp ne i32 [[TMP14]], 0
233 // CHECK1-NEXT: br i1 [[TMP15]], label [[DOTOMP_FINAL_THEN:%.*]], label [[DOTOMP_FINAL_DONE:%.*]]
234 // CHECK1: .omp.final.then:
235 // CHECK1-NEXT: store i32 2, ptr [[I]], align 4
236 // CHECK1-NEXT: br label [[DOTOMP_FINAL_DONE]]
237 // CHECK1: .omp.final.done:
238 // CHECK1-NEXT: [[TMP16:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i64 0, i64 0
239 // CHECK1-NEXT: store ptr [[SIVAR1]], ptr [[TMP16]], align 8
240 // CHECK1-NEXT: [[TMP17:%.*]] = 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_l70.omp_outlined.omp.reduction.reduction_func, ptr @.gomp_critical_user_.reduction.var)
241 // CHECK1-NEXT: switch i32 [[TMP17]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
242 // CHECK1-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
243 // CHECK1-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
244 // CHECK1-NEXT: ]
245 // CHECK1: .omp.reduction.case1:
246 // CHECK1-NEXT: [[TMP18:%.*]] = load i32, ptr [[TMP0]], align 4
247 // CHECK1-NEXT: [[TMP19:%.*]] = load i32, ptr [[SIVAR1]], align 4
248 // CHECK1-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP18]], [[TMP19]]
249 // CHECK1-NEXT: store i32 [[ADD3]], ptr [[TMP0]], align 4
250 // CHECK1-NEXT: call void @__kmpc_end_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP2]], ptr @.gomp_critical_user_.reduction.var)
251 // CHECK1-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
252 // CHECK1: .omp.reduction.case2:
253 // CHECK1-NEXT: [[TMP20:%.*]] = load i32, ptr [[SIVAR1]], align 4
254 // CHECK1-NEXT: [[TMP21:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP20]] monotonic, align 4
255 // CHECK1-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
256 // CHECK1: .omp.reduction.default:
257 // CHECK1-NEXT: ret void
260 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l70.omp_outlined.omp_outlined
261 // 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:%.*]]) #[[ATTR2]] {
262 // CHECK1-NEXT: entry:
263 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
264 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
265 // CHECK1-NEXT: [[DOTPREVIOUS_LB__ADDR:%.*]] = alloca i64, align 8
266 // CHECK1-NEXT: [[DOTPREVIOUS_UB__ADDR:%.*]] = alloca i64, align 8
267 // CHECK1-NEXT: [[SIVAR_ADDR:%.*]] = alloca ptr, align 8
268 // CHECK1-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
269 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
270 // CHECK1-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
271 // CHECK1-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
272 // CHECK1-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
273 // CHECK1-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
274 // CHECK1-NEXT: [[SIVAR2:%.*]] = alloca i32, align 4
275 // CHECK1-NEXT: [[I:%.*]] = alloca i32, align 4
276 // CHECK1-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 8
277 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
278 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
279 // CHECK1-NEXT: store i64 [[DOTPREVIOUS_LB_]], ptr [[DOTPREVIOUS_LB__ADDR]], align 8
280 // CHECK1-NEXT: store i64 [[DOTPREVIOUS_UB_]], ptr [[DOTPREVIOUS_UB__ADDR]], align 8
281 // CHECK1-NEXT: store ptr [[SIVAR]], ptr [[SIVAR_ADDR]], align 8
282 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[SIVAR_ADDR]], align 8
283 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
284 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_UB]], align 4
285 // CHECK1-NEXT: [[TMP1:%.*]] = load i64, ptr [[DOTPREVIOUS_LB__ADDR]], align 8
286 // CHECK1-NEXT: [[CONV:%.*]] = trunc i64 [[TMP1]] to i32
287 // CHECK1-NEXT: [[TMP2:%.*]] = load i64, ptr [[DOTPREVIOUS_UB__ADDR]], align 8
288 // CHECK1-NEXT: [[CONV1:%.*]] = trunc i64 [[TMP2]] to i32
289 // CHECK1-NEXT: store i32 [[CONV]], ptr [[DOTOMP_LB]], align 4
290 // CHECK1-NEXT: store i32 [[CONV1]], ptr [[DOTOMP_UB]], align 4
291 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
292 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
293 // CHECK1-NEXT: store i32 0, ptr [[SIVAR2]], align 4
294 // CHECK1-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
295 // CHECK1-NEXT: [[TMP4:%.*]] = load i32, ptr [[TMP3]], align 4
296 // 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)
297 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
298 // CHECK1-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP5]], 1
299 // CHECK1-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
300 // CHECK1: cond.true:
301 // CHECK1-NEXT: br label [[COND_END:%.*]]
302 // CHECK1: cond.false:
303 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
304 // CHECK1-NEXT: br label [[COND_END]]
305 // CHECK1: cond.end:
306 // CHECK1-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP6]], [[COND_FALSE]] ]
307 // CHECK1-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
308 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
309 // CHECK1-NEXT: store i32 [[TMP7]], ptr [[DOTOMP_IV]], align 4
310 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
311 // CHECK1: omp.inner.for.cond:
312 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP9:![0-9]+]]
313 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4, !llvm.access.group [[ACC_GRP9]]
314 // CHECK1-NEXT: [[CMP3:%.*]] = icmp sle i32 [[TMP8]], [[TMP9]]
315 // CHECK1-NEXT: br i1 [[CMP3]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
316 // CHECK1: omp.inner.for.body:
317 // CHECK1-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP9]]
318 // CHECK1-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP10]], 1
319 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
320 // CHECK1-NEXT: store i32 [[ADD]], ptr [[I]], align 4, !llvm.access.group [[ACC_GRP9]]
321 // CHECK1-NEXT: [[TMP11:%.*]] = load i32, ptr [[I]], align 4, !llvm.access.group [[ACC_GRP9]]
322 // CHECK1-NEXT: [[TMP12:%.*]] = load i32, ptr [[SIVAR2]], align 4, !llvm.access.group [[ACC_GRP9]]
323 // CHECK1-NEXT: [[ADD4:%.*]] = add nsw i32 [[TMP12]], [[TMP11]]
324 // CHECK1-NEXT: store i32 [[ADD4]], ptr [[SIVAR2]], align 4, !llvm.access.group [[ACC_GRP9]]
325 // CHECK1-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
326 // CHECK1: omp.body.continue:
327 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
328 // CHECK1: omp.inner.for.inc:
329 // CHECK1-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP9]]
330 // CHECK1-NEXT: [[ADD5:%.*]] = add nsw i32 [[TMP13]], 1
331 // CHECK1-NEXT: store i32 [[ADD5]], ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP9]]
332 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]], !llvm.loop [[LOOP10:![0-9]+]]
333 // CHECK1: omp.inner.for.end:
334 // CHECK1-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
335 // CHECK1: omp.loop.exit:
336 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP4]])
337 // CHECK1-NEXT: [[TMP14:%.*]] = load i32, ptr [[DOTOMP_IS_LAST]], align 4
338 // CHECK1-NEXT: [[TMP15:%.*]] = icmp ne i32 [[TMP14]], 0
339 // CHECK1-NEXT: br i1 [[TMP15]], label [[DOTOMP_FINAL_THEN:%.*]], label [[DOTOMP_FINAL_DONE:%.*]]
340 // CHECK1: .omp.final.then:
341 // CHECK1-NEXT: store i32 2, ptr [[I]], align 4
342 // CHECK1-NEXT: br label [[DOTOMP_FINAL_DONE]]
343 // CHECK1: .omp.final.done:
344 // CHECK1-NEXT: [[TMP16:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i64 0, i64 0
345 // CHECK1-NEXT: store ptr [[SIVAR2]], ptr [[TMP16]], align 8
346 // CHECK1-NEXT: [[TMP17:%.*]] = 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_l70.omp_outlined.omp_outlined.omp.reduction.reduction_func, ptr @.gomp_critical_user_.reduction.var)
347 // CHECK1-NEXT: switch i32 [[TMP17]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
348 // CHECK1-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
349 // CHECK1-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
350 // CHECK1-NEXT: ]
351 // CHECK1: .omp.reduction.case1:
352 // CHECK1-NEXT: [[TMP18:%.*]] = load i32, ptr [[TMP0]], align 4
353 // CHECK1-NEXT: [[TMP19:%.*]] = load i32, ptr [[SIVAR2]], align 4
354 // CHECK1-NEXT: [[ADD6:%.*]] = add nsw i32 [[TMP18]], [[TMP19]]
355 // CHECK1-NEXT: store i32 [[ADD6]], ptr [[TMP0]], align 4
356 // CHECK1-NEXT: call void @__kmpc_end_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP4]], ptr @.gomp_critical_user_.reduction.var)
357 // CHECK1-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
358 // CHECK1: .omp.reduction.case2:
359 // CHECK1-NEXT: [[TMP20:%.*]] = load i32, ptr [[SIVAR2]], align 4
360 // CHECK1-NEXT: [[TMP21:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP20]] monotonic, align 4
361 // CHECK1-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
362 // CHECK1: .omp.reduction.default:
363 // CHECK1-NEXT: ret void
366 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l70.omp_outlined.omp_outlined.omp.reduction.reduction_func
367 // CHECK1-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR4:[0-9]+]] {
368 // CHECK1-NEXT: entry:
369 // CHECK1-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 8
370 // CHECK1-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 8
371 // CHECK1-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 8
372 // CHECK1-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 8
373 // CHECK1-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 8
374 // CHECK1-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 8
375 // CHECK1-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i64 0, i64 0
376 // CHECK1-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 8
377 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i64 0, i64 0
378 // CHECK1-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 8
379 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
380 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
381 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
382 // CHECK1-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
383 // CHECK1-NEXT: ret void
386 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l70.omp_outlined.omp.reduction.reduction_func
387 // CHECK1-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR4]] {
388 // CHECK1-NEXT: entry:
389 // CHECK1-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 8
390 // CHECK1-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 8
391 // CHECK1-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 8
392 // CHECK1-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 8
393 // CHECK1-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 8
394 // CHECK1-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 8
395 // CHECK1-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i64 0, i64 0
396 // CHECK1-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 8
397 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i64 0, i64 0
398 // CHECK1-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 8
399 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
400 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
401 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
402 // CHECK1-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
403 // CHECK1-NEXT: ret void
406 // CHECK1-LABEL: define {{[^@]+}}@_Z5tmainIiET_v
407 // CHECK1-SAME: () #[[ATTR6:[0-9]+]] comdat {
408 // CHECK1-NEXT: entry:
409 // CHECK1-NEXT: [[T_VAR:%.*]] = alloca i32, align 4
410 // CHECK1-NEXT: [[VEC:%.*]] = alloca [2 x i32], align 4
411 // CHECK1-NEXT: [[T_VAR_CASTED:%.*]] = alloca i64, align 8
412 // CHECK1-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [1 x ptr], align 8
413 // CHECK1-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [1 x ptr], align 8
414 // CHECK1-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [1 x ptr], align 8
415 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
416 // CHECK1-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
417 // CHECK1-NEXT: store i32 0, ptr [[T_VAR]], align 4
418 // CHECK1-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[VEC]], ptr align 4 @__const._Z5tmainIiET_v.vec, i64 8, i1 false)
419 // CHECK1-NEXT: [[TMP0:%.*]] = load i32, ptr [[T_VAR]], align 4
420 // CHECK1-NEXT: store i32 [[TMP0]], ptr [[T_VAR_CASTED]], align 4
421 // CHECK1-NEXT: [[TMP1:%.*]] = load i64, ptr [[T_VAR_CASTED]], align 8
422 // CHECK1-NEXT: [[TMP2:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
423 // CHECK1-NEXT: store i64 [[TMP1]], ptr [[TMP2]], align 8
424 // CHECK1-NEXT: [[TMP3:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
425 // CHECK1-NEXT: store i64 [[TMP1]], ptr [[TMP3]], align 8
426 // CHECK1-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 0
427 // CHECK1-NEXT: store ptr null, ptr [[TMP4]], align 8
428 // CHECK1-NEXT: [[TMP5:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
429 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
430 // CHECK1-NEXT: [[TMP7:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
431 // CHECK1-NEXT: store i32 2, ptr [[TMP7]], align 4
432 // CHECK1-NEXT: [[TMP8:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
433 // CHECK1-NEXT: store i32 1, ptr [[TMP8]], align 4
434 // CHECK1-NEXT: [[TMP9:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
435 // CHECK1-NEXT: store ptr [[TMP5]], ptr [[TMP9]], align 8
436 // CHECK1-NEXT: [[TMP10:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
437 // CHECK1-NEXT: store ptr [[TMP6]], ptr [[TMP10]], align 8
438 // CHECK1-NEXT: [[TMP11:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
439 // CHECK1-NEXT: store ptr @.offload_sizes.1, ptr [[TMP11]], align 8
440 // CHECK1-NEXT: [[TMP12:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
441 // CHECK1-NEXT: store ptr @.offload_maptypes.2, ptr [[TMP12]], align 8
442 // CHECK1-NEXT: [[TMP13:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
443 // CHECK1-NEXT: store ptr null, ptr [[TMP13]], align 8
444 // CHECK1-NEXT: [[TMP14:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
445 // CHECK1-NEXT: store ptr null, ptr [[TMP14]], align 8
446 // CHECK1-NEXT: [[TMP15:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
447 // CHECK1-NEXT: store i64 2, ptr [[TMP15]], align 8
448 // CHECK1-NEXT: [[TMP16:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
449 // CHECK1-NEXT: store i64 0, ptr [[TMP16]], align 8
450 // CHECK1-NEXT: [[TMP17:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
451 // CHECK1-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP17]], align 4
452 // CHECK1-NEXT: [[TMP18:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
453 // CHECK1-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP18]], align 4
454 // CHECK1-NEXT: [[TMP19:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
455 // CHECK1-NEXT: store i32 0, ptr [[TMP19]], align 4
456 // CHECK1-NEXT: [[TMP20:%.*]] = 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]])
457 // CHECK1-NEXT: [[TMP21:%.*]] = icmp ne i32 [[TMP20]], 0
458 // CHECK1-NEXT: br i1 [[TMP21]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
459 // CHECK1: omp_offload.failed:
460 // CHECK1-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32(i64 [[TMP1]]) #[[ATTR3]]
461 // CHECK1-NEXT: br label [[OMP_OFFLOAD_CONT]]
462 // CHECK1: omp_offload.cont:
463 // CHECK1-NEXT: ret i32 0
466 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32
467 // CHECK1-SAME: (i64 noundef [[T_VAR:%.*]]) #[[ATTR1]] {
468 // CHECK1-NEXT: entry:
469 // CHECK1-NEXT: [[T_VAR_ADDR:%.*]] = alloca i64, align 8
470 // CHECK1-NEXT: store i64 [[T_VAR]], ptr [[T_VAR_ADDR]], align 8
471 // 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 [[T_VAR_ADDR]])
472 // CHECK1-NEXT: ret void
475 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined
476 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[T_VAR:%.*]]) #[[ATTR2]] {
477 // CHECK1-NEXT: entry:
478 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
479 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
480 // CHECK1-NEXT: [[T_VAR_ADDR:%.*]] = alloca ptr, align 8
481 // CHECK1-NEXT: [[T_VAR1:%.*]] = alloca i32, align 4
482 // CHECK1-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
483 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
484 // CHECK1-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
485 // CHECK1-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
486 // CHECK1-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
487 // CHECK1-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
488 // CHECK1-NEXT: [[I:%.*]] = alloca i32, align 4
489 // CHECK1-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 8
490 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
491 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
492 // CHECK1-NEXT: store ptr [[T_VAR]], ptr [[T_VAR_ADDR]], align 8
493 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[T_VAR_ADDR]], align 8
494 // CHECK1-NEXT: store i32 0, ptr [[T_VAR1]], align 4
495 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
496 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_COMB_UB]], align 4
497 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
498 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
499 // CHECK1-NEXT: [[TMP1:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
500 // CHECK1-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP1]], align 4
501 // 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)
502 // CHECK1-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
503 // CHECK1-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP3]], 1
504 // CHECK1-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
505 // CHECK1: cond.true:
506 // CHECK1-NEXT: br label [[COND_END:%.*]]
507 // CHECK1: cond.false:
508 // CHECK1-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
509 // CHECK1-NEXT: br label [[COND_END]]
510 // CHECK1: cond.end:
511 // CHECK1-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP4]], [[COND_FALSE]] ]
512 // CHECK1-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
513 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
514 // CHECK1-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_IV]], align 4
515 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
516 // CHECK1: omp.inner.for.cond:
517 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP14:![0-9]+]]
518 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4, !llvm.access.group [[ACC_GRP14]]
519 // CHECK1-NEXT: [[CMP2:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
520 // CHECK1-NEXT: br i1 [[CMP2]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
521 // CHECK1: omp.inner.for.body:
522 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4, !llvm.access.group [[ACC_GRP14]]
523 // CHECK1-NEXT: [[TMP9:%.*]] = zext i32 [[TMP8]] to i64
524 // CHECK1-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4, !llvm.access.group [[ACC_GRP14]]
525 // CHECK1-NEXT: [[TMP11:%.*]] = zext i32 [[TMP10]] to i64
526 // 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]]), !llvm.access.group [[ACC_GRP14]]
527 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
528 // CHECK1: omp.inner.for.inc:
529 // CHECK1-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP14]]
530 // CHECK1-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_STRIDE]], align 4, !llvm.access.group [[ACC_GRP14]]
531 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP12]], [[TMP13]]
532 // CHECK1-NEXT: store i32 [[ADD]], ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP14]]
533 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]], !llvm.loop [[LOOP15:![0-9]+]]
534 // CHECK1: omp.inner.for.end:
535 // CHECK1-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
536 // CHECK1: omp.loop.exit:
537 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP2]])
538 // CHECK1-NEXT: [[TMP14:%.*]] = load i32, ptr [[DOTOMP_IS_LAST]], align 4
539 // CHECK1-NEXT: [[TMP15:%.*]] = icmp ne i32 [[TMP14]], 0
540 // CHECK1-NEXT: br i1 [[TMP15]], label [[DOTOMP_FINAL_THEN:%.*]], label [[DOTOMP_FINAL_DONE:%.*]]
541 // CHECK1: .omp.final.then:
542 // CHECK1-NEXT: store i32 2, ptr [[I]], align 4
543 // CHECK1-NEXT: br label [[DOTOMP_FINAL_DONE]]
544 // CHECK1: .omp.final.done:
545 // CHECK1-NEXT: [[TMP16:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i64 0, i64 0
546 // CHECK1-NEXT: store ptr [[T_VAR1]], ptr [[TMP16]], align 8
547 // CHECK1-NEXT: [[TMP17:%.*]] = 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)
548 // CHECK1-NEXT: switch i32 [[TMP17]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
549 // CHECK1-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
550 // CHECK1-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
551 // CHECK1-NEXT: ]
552 // CHECK1: .omp.reduction.case1:
553 // CHECK1-NEXT: [[TMP18:%.*]] = load i32, ptr [[TMP0]], align 4
554 // CHECK1-NEXT: [[TMP19:%.*]] = load i32, ptr [[T_VAR1]], align 4
555 // CHECK1-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP18]], [[TMP19]]
556 // CHECK1-NEXT: store i32 [[ADD3]], ptr [[TMP0]], align 4
557 // CHECK1-NEXT: call void @__kmpc_end_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP2]], ptr @.gomp_critical_user_.reduction.var)
558 // CHECK1-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
559 // CHECK1: .omp.reduction.case2:
560 // CHECK1-NEXT: [[TMP20:%.*]] = load i32, ptr [[T_VAR1]], align 4
561 // CHECK1-NEXT: [[TMP21:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP20]] monotonic, align 4
562 // CHECK1-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
563 // CHECK1: .omp.reduction.default:
564 // CHECK1-NEXT: ret void
567 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined.omp_outlined
568 // 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:%.*]]) #[[ATTR2]] {
569 // CHECK1-NEXT: entry:
570 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
571 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
572 // CHECK1-NEXT: [[DOTPREVIOUS_LB__ADDR:%.*]] = alloca i64, align 8
573 // CHECK1-NEXT: [[DOTPREVIOUS_UB__ADDR:%.*]] = alloca i64, align 8
574 // CHECK1-NEXT: [[T_VAR_ADDR:%.*]] = alloca ptr, align 8
575 // CHECK1-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
576 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
577 // CHECK1-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
578 // CHECK1-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
579 // CHECK1-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
580 // CHECK1-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
581 // CHECK1-NEXT: [[T_VAR2:%.*]] = alloca i32, align 4
582 // CHECK1-NEXT: [[I:%.*]] = alloca i32, align 4
583 // CHECK1-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 8
584 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
585 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
586 // CHECK1-NEXT: store i64 [[DOTPREVIOUS_LB_]], ptr [[DOTPREVIOUS_LB__ADDR]], align 8
587 // CHECK1-NEXT: store i64 [[DOTPREVIOUS_UB_]], ptr [[DOTPREVIOUS_UB__ADDR]], align 8
588 // CHECK1-NEXT: store ptr [[T_VAR]], ptr [[T_VAR_ADDR]], align 8
589 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[T_VAR_ADDR]], align 8
590 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
591 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_UB]], align 4
592 // CHECK1-NEXT: [[TMP1:%.*]] = load i64, ptr [[DOTPREVIOUS_LB__ADDR]], align 8
593 // CHECK1-NEXT: [[CONV:%.*]] = trunc i64 [[TMP1]] to i32
594 // CHECK1-NEXT: [[TMP2:%.*]] = load i64, ptr [[DOTPREVIOUS_UB__ADDR]], align 8
595 // CHECK1-NEXT: [[CONV1:%.*]] = trunc i64 [[TMP2]] to i32
596 // CHECK1-NEXT: store i32 [[CONV]], ptr [[DOTOMP_LB]], align 4
597 // CHECK1-NEXT: store i32 [[CONV1]], ptr [[DOTOMP_UB]], align 4
598 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
599 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
600 // CHECK1-NEXT: store i32 0, ptr [[T_VAR2]], align 4
601 // CHECK1-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
602 // CHECK1-NEXT: [[TMP4:%.*]] = load i32, ptr [[TMP3]], align 4
603 // 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)
604 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
605 // CHECK1-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP5]], 1
606 // CHECK1-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
607 // CHECK1: cond.true:
608 // CHECK1-NEXT: br label [[COND_END:%.*]]
609 // CHECK1: cond.false:
610 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
611 // CHECK1-NEXT: br label [[COND_END]]
612 // CHECK1: cond.end:
613 // CHECK1-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP6]], [[COND_FALSE]] ]
614 // CHECK1-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
615 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
616 // CHECK1-NEXT: store i32 [[TMP7]], ptr [[DOTOMP_IV]], align 4
617 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
618 // CHECK1: omp.inner.for.cond:
619 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP17:![0-9]+]]
620 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4, !llvm.access.group [[ACC_GRP17]]
621 // CHECK1-NEXT: [[CMP3:%.*]] = icmp sle i32 [[TMP8]], [[TMP9]]
622 // CHECK1-NEXT: br i1 [[CMP3]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
623 // CHECK1: omp.inner.for.body:
624 // CHECK1-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP17]]
625 // CHECK1-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP10]], 1
626 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
627 // CHECK1-NEXT: store i32 [[ADD]], ptr [[I]], align 4, !llvm.access.group [[ACC_GRP17]]
628 // CHECK1-NEXT: [[TMP11:%.*]] = load i32, ptr [[I]], align 4, !llvm.access.group [[ACC_GRP17]]
629 // CHECK1-NEXT: [[TMP12:%.*]] = load i32, ptr [[T_VAR2]], align 4, !llvm.access.group [[ACC_GRP17]]
630 // CHECK1-NEXT: [[ADD4:%.*]] = add nsw i32 [[TMP12]], [[TMP11]]
631 // CHECK1-NEXT: store i32 [[ADD4]], ptr [[T_VAR2]], align 4, !llvm.access.group [[ACC_GRP17]]
632 // CHECK1-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
633 // CHECK1: omp.body.continue:
634 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
635 // CHECK1: omp.inner.for.inc:
636 // CHECK1-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP17]]
637 // CHECK1-NEXT: [[ADD5:%.*]] = add nsw i32 [[TMP13]], 1
638 // CHECK1-NEXT: store i32 [[ADD5]], ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP17]]
639 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]], !llvm.loop [[LOOP18:![0-9]+]]
640 // CHECK1: omp.inner.for.end:
641 // CHECK1-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
642 // CHECK1: omp.loop.exit:
643 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP4]])
644 // CHECK1-NEXT: [[TMP14:%.*]] = load i32, ptr [[DOTOMP_IS_LAST]], align 4
645 // CHECK1-NEXT: [[TMP15:%.*]] = icmp ne i32 [[TMP14]], 0
646 // CHECK1-NEXT: br i1 [[TMP15]], label [[DOTOMP_FINAL_THEN:%.*]], label [[DOTOMP_FINAL_DONE:%.*]]
647 // CHECK1: .omp.final.then:
648 // CHECK1-NEXT: store i32 2, ptr [[I]], align 4
649 // CHECK1-NEXT: br label [[DOTOMP_FINAL_DONE]]
650 // CHECK1: .omp.final.done:
651 // CHECK1-NEXT: [[TMP16:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i64 0, i64 0
652 // CHECK1-NEXT: store ptr [[T_VAR2]], ptr [[TMP16]], align 8
653 // CHECK1-NEXT: [[TMP17:%.*]] = 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)
654 // CHECK1-NEXT: switch i32 [[TMP17]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
655 // CHECK1-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
656 // CHECK1-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
657 // CHECK1-NEXT: ]
658 // CHECK1: .omp.reduction.case1:
659 // CHECK1-NEXT: [[TMP18:%.*]] = load i32, ptr [[TMP0]], align 4
660 // CHECK1-NEXT: [[TMP19:%.*]] = load i32, ptr [[T_VAR2]], align 4
661 // CHECK1-NEXT: [[ADD6:%.*]] = add nsw i32 [[TMP18]], [[TMP19]]
662 // CHECK1-NEXT: store i32 [[ADD6]], ptr [[TMP0]], align 4
663 // CHECK1-NEXT: call void @__kmpc_end_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP4]], ptr @.gomp_critical_user_.reduction.var)
664 // CHECK1-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
665 // CHECK1: .omp.reduction.case2:
666 // CHECK1-NEXT: [[TMP20:%.*]] = load i32, ptr [[T_VAR2]], align 4
667 // CHECK1-NEXT: [[TMP21:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP20]] monotonic, align 4
668 // CHECK1-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
669 // CHECK1: .omp.reduction.default:
670 // CHECK1-NEXT: ret void
673 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined.omp_outlined.omp.reduction.reduction_func
674 // CHECK1-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR4]] {
675 // CHECK1-NEXT: entry:
676 // CHECK1-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 8
677 // CHECK1-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 8
678 // CHECK1-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 8
679 // CHECK1-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 8
680 // CHECK1-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 8
681 // CHECK1-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 8
682 // CHECK1-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i64 0, i64 0
683 // CHECK1-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 8
684 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i64 0, i64 0
685 // CHECK1-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 8
686 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
687 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
688 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
689 // CHECK1-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
690 // CHECK1-NEXT: ret void
693 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined.omp.reduction.reduction_func
694 // CHECK1-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR4]] {
695 // CHECK1-NEXT: entry:
696 // CHECK1-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 8
697 // CHECK1-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 8
698 // CHECK1-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 8
699 // CHECK1-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 8
700 // CHECK1-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 8
701 // CHECK1-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 8
702 // CHECK1-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i64 0, i64 0
703 // CHECK1-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 8
704 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i64 0, i64 0
705 // CHECK1-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 8
706 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
707 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
708 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
709 // CHECK1-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
710 // CHECK1-NEXT: ret void
713 // CHECK1-LABEL: define {{[^@]+}}@.omp_offloading.requires_reg
714 // CHECK1-SAME: () #[[ATTR8:[0-9]+]] {
715 // CHECK1-NEXT: entry:
716 // CHECK1-NEXT: call void @__tgt_register_requires(i64 1)
717 // CHECK1-NEXT: ret void
720 // CHECK3-LABEL: define {{[^@]+}}@main
721 // CHECK3-SAME: () #[[ATTR0:[0-9]+]] {
722 // CHECK3-NEXT: entry:
723 // CHECK3-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
724 // CHECK3-NEXT: [[SIVAR_CASTED:%.*]] = alloca i32, align 4
725 // CHECK3-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [1 x ptr], align 4
726 // CHECK3-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [1 x ptr], align 4
727 // CHECK3-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [1 x ptr], align 4
728 // CHECK3-NEXT: [[TMP:%.*]] = alloca i32, align 4
729 // CHECK3-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
730 // CHECK3-NEXT: store i32 0, ptr [[RETVAL]], align 4
731 // CHECK3-NEXT: [[TMP0:%.*]] = load i32, ptr @_ZZ4mainE5sivar, align 4
732 // CHECK3-NEXT: store i32 [[TMP0]], ptr [[SIVAR_CASTED]], align 4
733 // CHECK3-NEXT: [[TMP1:%.*]] = load i32, ptr [[SIVAR_CASTED]], align 4
734 // CHECK3-NEXT: [[TMP2:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
735 // CHECK3-NEXT: store i32 [[TMP1]], ptr [[TMP2]], align 4
736 // CHECK3-NEXT: [[TMP3:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
737 // CHECK3-NEXT: store i32 [[TMP1]], ptr [[TMP3]], align 4
738 // CHECK3-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i32 0, i32 0
739 // CHECK3-NEXT: store ptr null, ptr [[TMP4]], align 4
740 // CHECK3-NEXT: [[TMP5:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
741 // CHECK3-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
742 // CHECK3-NEXT: [[TMP7:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
743 // CHECK3-NEXT: store i32 2, ptr [[TMP7]], align 4
744 // CHECK3-NEXT: [[TMP8:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
745 // CHECK3-NEXT: store i32 1, ptr [[TMP8]], align 4
746 // CHECK3-NEXT: [[TMP9:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
747 // CHECK3-NEXT: store ptr [[TMP5]], ptr [[TMP9]], align 4
748 // CHECK3-NEXT: [[TMP10:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
749 // CHECK3-NEXT: store ptr [[TMP6]], ptr [[TMP10]], align 4
750 // CHECK3-NEXT: [[TMP11:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
751 // CHECK3-NEXT: store ptr @.offload_sizes, ptr [[TMP11]], align 4
752 // CHECK3-NEXT: [[TMP12:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
753 // CHECK3-NEXT: store ptr @.offload_maptypes, ptr [[TMP12]], align 4
754 // CHECK3-NEXT: [[TMP13:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
755 // CHECK3-NEXT: store ptr null, ptr [[TMP13]], align 4
756 // CHECK3-NEXT: [[TMP14:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
757 // CHECK3-NEXT: store ptr null, ptr [[TMP14]], align 4
758 // CHECK3-NEXT: [[TMP15:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
759 // CHECK3-NEXT: store i64 2, ptr [[TMP15]], align 8
760 // CHECK3-NEXT: [[TMP16:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
761 // CHECK3-NEXT: store i64 0, ptr [[TMP16]], align 8
762 // CHECK3-NEXT: [[TMP17:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
763 // CHECK3-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP17]], align 4
764 // CHECK3-NEXT: [[TMP18:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
765 // CHECK3-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP18]], align 4
766 // CHECK3-NEXT: [[TMP19:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
767 // CHECK3-NEXT: store i32 0, ptr [[TMP19]], align 4
768 // CHECK3-NEXT: [[TMP20:%.*]] = 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_l70.region_id, ptr [[KERNEL_ARGS]])
769 // CHECK3-NEXT: [[TMP21:%.*]] = icmp ne i32 [[TMP20]], 0
770 // CHECK3-NEXT: br i1 [[TMP21]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
771 // CHECK3: omp_offload.failed:
772 // CHECK3-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l70(i32 [[TMP1]]) #[[ATTR3:[0-9]+]]
773 // CHECK3-NEXT: br label [[OMP_OFFLOAD_CONT]]
774 // CHECK3: omp_offload.cont:
775 // CHECK3-NEXT: [[CALL:%.*]] = call noundef i32 @_Z5tmainIiET_v()
776 // CHECK3-NEXT: ret i32 [[CALL]]
779 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l70
780 // CHECK3-SAME: (i32 noundef [[SIVAR:%.*]]) #[[ATTR1:[0-9]+]] {
781 // CHECK3-NEXT: entry:
782 // CHECK3-NEXT: [[SIVAR_ADDR:%.*]] = alloca i32, align 4
783 // CHECK3-NEXT: store i32 [[SIVAR]], ptr [[SIVAR_ADDR]], align 4
784 // CHECK3-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB4]], i32 1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l70.omp_outlined, ptr [[SIVAR_ADDR]])
785 // CHECK3-NEXT: ret void
788 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l70.omp_outlined
789 // CHECK3-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[SIVAR:%.*]]) #[[ATTR2:[0-9]+]] {
790 // CHECK3-NEXT: entry:
791 // CHECK3-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 4
792 // CHECK3-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 4
793 // CHECK3-NEXT: [[SIVAR_ADDR:%.*]] = alloca ptr, align 4
794 // CHECK3-NEXT: [[SIVAR1:%.*]] = alloca i32, align 4
795 // CHECK3-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
796 // CHECK3-NEXT: [[TMP:%.*]] = alloca i32, align 4
797 // CHECK3-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
798 // CHECK3-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
799 // CHECK3-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
800 // CHECK3-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
801 // CHECK3-NEXT: [[I:%.*]] = alloca i32, align 4
802 // CHECK3-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 4
803 // CHECK3-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 4
804 // CHECK3-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 4
805 // CHECK3-NEXT: store ptr [[SIVAR]], ptr [[SIVAR_ADDR]], align 4
806 // CHECK3-NEXT: [[TMP0:%.*]] = load ptr, ptr [[SIVAR_ADDR]], align 4
807 // CHECK3-NEXT: store i32 0, ptr [[SIVAR1]], align 4
808 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
809 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_COMB_UB]], align 4
810 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
811 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
812 // CHECK3-NEXT: [[TMP1:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 4
813 // CHECK3-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP1]], align 4
814 // 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)
815 // CHECK3-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
816 // CHECK3-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP3]], 1
817 // CHECK3-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
818 // CHECK3: cond.true:
819 // CHECK3-NEXT: br label [[COND_END:%.*]]
820 // CHECK3: cond.false:
821 // CHECK3-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
822 // CHECK3-NEXT: br label [[COND_END]]
823 // CHECK3: cond.end:
824 // CHECK3-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP4]], [[COND_FALSE]] ]
825 // CHECK3-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
826 // CHECK3-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
827 // CHECK3-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_IV]], align 4
828 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
829 // CHECK3: omp.inner.for.cond:
830 // CHECK3-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP6:![0-9]+]]
831 // CHECK3-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4, !llvm.access.group [[ACC_GRP6]]
832 // CHECK3-NEXT: [[CMP2:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
833 // CHECK3-NEXT: br i1 [[CMP2]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
834 // CHECK3: omp.inner.for.body:
835 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4, !llvm.access.group [[ACC_GRP6]]
836 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4, !llvm.access.group [[ACC_GRP6]]
837 // CHECK3-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB4]], i32 3, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l70.omp_outlined.omp_outlined, i32 [[TMP8]], i32 [[TMP9]], ptr [[SIVAR1]]), !llvm.access.group [[ACC_GRP6]]
838 // CHECK3-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
839 // CHECK3: omp.inner.for.inc:
840 // CHECK3-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP6]]
841 // CHECK3-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_STRIDE]], align 4, !llvm.access.group [[ACC_GRP6]]
842 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP10]], [[TMP11]]
843 // CHECK3-NEXT: store i32 [[ADD]], ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP6]]
844 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND]], !llvm.loop [[LOOP7:![0-9]+]]
845 // CHECK3: omp.inner.for.end:
846 // CHECK3-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
847 // CHECK3: omp.loop.exit:
848 // CHECK3-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP2]])
849 // CHECK3-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_IS_LAST]], align 4
850 // CHECK3-NEXT: [[TMP13:%.*]] = icmp ne i32 [[TMP12]], 0
851 // CHECK3-NEXT: br i1 [[TMP13]], label [[DOTOMP_FINAL_THEN:%.*]], label [[DOTOMP_FINAL_DONE:%.*]]
852 // CHECK3: .omp.final.then:
853 // CHECK3-NEXT: store i32 2, ptr [[I]], align 4
854 // CHECK3-NEXT: br label [[DOTOMP_FINAL_DONE]]
855 // CHECK3: .omp.final.done:
856 // CHECK3-NEXT: [[TMP14:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i32 0, i32 0
857 // CHECK3-NEXT: store ptr [[SIVAR1]], ptr [[TMP14]], align 4
858 // CHECK3-NEXT: [[TMP15:%.*]] = 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_l70.omp_outlined.omp.reduction.reduction_func, ptr @.gomp_critical_user_.reduction.var)
859 // CHECK3-NEXT: switch i32 [[TMP15]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
860 // CHECK3-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
861 // CHECK3-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
862 // CHECK3-NEXT: ]
863 // CHECK3: .omp.reduction.case1:
864 // CHECK3-NEXT: [[TMP16:%.*]] = load i32, ptr [[TMP0]], align 4
865 // CHECK3-NEXT: [[TMP17:%.*]] = load i32, ptr [[SIVAR1]], align 4
866 // CHECK3-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP16]], [[TMP17]]
867 // CHECK3-NEXT: store i32 [[ADD3]], ptr [[TMP0]], align 4
868 // CHECK3-NEXT: call void @__kmpc_end_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP2]], ptr @.gomp_critical_user_.reduction.var)
869 // CHECK3-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
870 // CHECK3: .omp.reduction.case2:
871 // CHECK3-NEXT: [[TMP18:%.*]] = load i32, ptr [[SIVAR1]], align 4
872 // CHECK3-NEXT: [[TMP19:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP18]] monotonic, align 4
873 // CHECK3-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
874 // CHECK3: .omp.reduction.default:
875 // CHECK3-NEXT: ret void
878 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l70.omp_outlined.omp_outlined
879 // 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:%.*]]) #[[ATTR2]] {
880 // CHECK3-NEXT: entry:
881 // CHECK3-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 4
882 // CHECK3-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 4
883 // CHECK3-NEXT: [[DOTPREVIOUS_LB__ADDR:%.*]] = alloca i32, align 4
884 // CHECK3-NEXT: [[DOTPREVIOUS_UB__ADDR:%.*]] = alloca i32, align 4
885 // CHECK3-NEXT: [[SIVAR_ADDR:%.*]] = alloca ptr, align 4
886 // CHECK3-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
887 // CHECK3-NEXT: [[TMP:%.*]] = alloca i32, align 4
888 // CHECK3-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
889 // CHECK3-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
890 // CHECK3-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
891 // CHECK3-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
892 // CHECK3-NEXT: [[SIVAR1:%.*]] = alloca i32, align 4
893 // CHECK3-NEXT: [[I:%.*]] = alloca i32, align 4
894 // CHECK3-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 4
895 // CHECK3-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 4
896 // CHECK3-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 4
897 // CHECK3-NEXT: store i32 [[DOTPREVIOUS_LB_]], ptr [[DOTPREVIOUS_LB__ADDR]], align 4
898 // CHECK3-NEXT: store i32 [[DOTPREVIOUS_UB_]], ptr [[DOTPREVIOUS_UB__ADDR]], align 4
899 // CHECK3-NEXT: store ptr [[SIVAR]], ptr [[SIVAR_ADDR]], align 4
900 // CHECK3-NEXT: [[TMP0:%.*]] = load ptr, ptr [[SIVAR_ADDR]], align 4
901 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
902 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_UB]], align 4
903 // CHECK3-NEXT: [[TMP1:%.*]] = load i32, ptr [[DOTPREVIOUS_LB__ADDR]], align 4
904 // CHECK3-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTPREVIOUS_UB__ADDR]], align 4
905 // CHECK3-NEXT: store i32 [[TMP1]], ptr [[DOTOMP_LB]], align 4
906 // CHECK3-NEXT: store i32 [[TMP2]], ptr [[DOTOMP_UB]], align 4
907 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
908 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
909 // CHECK3-NEXT: store i32 0, ptr [[SIVAR1]], align 4
910 // CHECK3-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 4
911 // CHECK3-NEXT: [[TMP4:%.*]] = load i32, ptr [[TMP3]], align 4
912 // 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)
913 // CHECK3-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
914 // CHECK3-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP5]], 1
915 // CHECK3-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
916 // CHECK3: cond.true:
917 // CHECK3-NEXT: br label [[COND_END:%.*]]
918 // CHECK3: cond.false:
919 // CHECK3-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
920 // CHECK3-NEXT: br label [[COND_END]]
921 // CHECK3: cond.end:
922 // CHECK3-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP6]], [[COND_FALSE]] ]
923 // CHECK3-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
924 // CHECK3-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
925 // CHECK3-NEXT: store i32 [[TMP7]], ptr [[DOTOMP_IV]], align 4
926 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
927 // CHECK3: omp.inner.for.cond:
928 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP10:![0-9]+]]
929 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4, !llvm.access.group [[ACC_GRP10]]
930 // CHECK3-NEXT: [[CMP2:%.*]] = icmp sle i32 [[TMP8]], [[TMP9]]
931 // CHECK3-NEXT: br i1 [[CMP2]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
932 // CHECK3: omp.inner.for.body:
933 // CHECK3-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP10]]
934 // CHECK3-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP10]], 1
935 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
936 // CHECK3-NEXT: store i32 [[ADD]], ptr [[I]], align 4, !llvm.access.group [[ACC_GRP10]]
937 // CHECK3-NEXT: [[TMP11:%.*]] = load i32, ptr [[I]], align 4, !llvm.access.group [[ACC_GRP10]]
938 // CHECK3-NEXT: [[TMP12:%.*]] = load i32, ptr [[SIVAR1]], align 4, !llvm.access.group [[ACC_GRP10]]
939 // CHECK3-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP12]], [[TMP11]]
940 // CHECK3-NEXT: store i32 [[ADD3]], ptr [[SIVAR1]], align 4, !llvm.access.group [[ACC_GRP10]]
941 // CHECK3-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
942 // CHECK3: omp.body.continue:
943 // CHECK3-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
944 // CHECK3: omp.inner.for.inc:
945 // CHECK3-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP10]]
946 // CHECK3-NEXT: [[ADD4:%.*]] = add nsw i32 [[TMP13]], 1
947 // CHECK3-NEXT: store i32 [[ADD4]], ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP10]]
948 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND]], !llvm.loop [[LOOP11:![0-9]+]]
949 // CHECK3: omp.inner.for.end:
950 // CHECK3-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
951 // CHECK3: omp.loop.exit:
952 // CHECK3-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP4]])
953 // CHECK3-NEXT: [[TMP14:%.*]] = load i32, ptr [[DOTOMP_IS_LAST]], align 4
954 // CHECK3-NEXT: [[TMP15:%.*]] = icmp ne i32 [[TMP14]], 0
955 // CHECK3-NEXT: br i1 [[TMP15]], label [[DOTOMP_FINAL_THEN:%.*]], label [[DOTOMP_FINAL_DONE:%.*]]
956 // CHECK3: .omp.final.then:
957 // CHECK3-NEXT: store i32 2, ptr [[I]], align 4
958 // CHECK3-NEXT: br label [[DOTOMP_FINAL_DONE]]
959 // CHECK3: .omp.final.done:
960 // CHECK3-NEXT: [[TMP16:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i32 0, i32 0
961 // CHECK3-NEXT: store ptr [[SIVAR1]], ptr [[TMP16]], align 4
962 // CHECK3-NEXT: [[TMP17:%.*]] = 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_l70.omp_outlined.omp_outlined.omp.reduction.reduction_func, ptr @.gomp_critical_user_.reduction.var)
963 // CHECK3-NEXT: switch i32 [[TMP17]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
964 // CHECK3-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
965 // CHECK3-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
966 // CHECK3-NEXT: ]
967 // CHECK3: .omp.reduction.case1:
968 // CHECK3-NEXT: [[TMP18:%.*]] = load i32, ptr [[TMP0]], align 4
969 // CHECK3-NEXT: [[TMP19:%.*]] = load i32, ptr [[SIVAR1]], align 4
970 // CHECK3-NEXT: [[ADD5:%.*]] = add nsw i32 [[TMP18]], [[TMP19]]
971 // CHECK3-NEXT: store i32 [[ADD5]], ptr [[TMP0]], align 4
972 // CHECK3-NEXT: call void @__kmpc_end_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP4]], ptr @.gomp_critical_user_.reduction.var)
973 // CHECK3-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
974 // CHECK3: .omp.reduction.case2:
975 // CHECK3-NEXT: [[TMP20:%.*]] = load i32, ptr [[SIVAR1]], align 4
976 // CHECK3-NEXT: [[TMP21:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP20]] monotonic, align 4
977 // CHECK3-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
978 // CHECK3: .omp.reduction.default:
979 // CHECK3-NEXT: ret void
982 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l70.omp_outlined.omp_outlined.omp.reduction.reduction_func
983 // CHECK3-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR4:[0-9]+]] {
984 // CHECK3-NEXT: entry:
985 // CHECK3-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 4
986 // CHECK3-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 4
987 // CHECK3-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 4
988 // CHECK3-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 4
989 // CHECK3-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 4
990 // CHECK3-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 4
991 // CHECK3-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i32 0, i32 0
992 // CHECK3-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 4
993 // CHECK3-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i32 0, i32 0
994 // CHECK3-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 4
995 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
996 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
997 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
998 // CHECK3-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
999 // CHECK3-NEXT: ret void
1002 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l70.omp_outlined.omp.reduction.reduction_func
1003 // CHECK3-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR4]] {
1004 // CHECK3-NEXT: entry:
1005 // CHECK3-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 4
1006 // CHECK3-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 4
1007 // CHECK3-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 4
1008 // CHECK3-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 4
1009 // CHECK3-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 4
1010 // CHECK3-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 4
1011 // CHECK3-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i32 0, i32 0
1012 // CHECK3-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 4
1013 // CHECK3-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i32 0, i32 0
1014 // CHECK3-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 4
1015 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
1016 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
1017 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
1018 // CHECK3-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
1019 // CHECK3-NEXT: ret void
1022 // CHECK3-LABEL: define {{[^@]+}}@_Z5tmainIiET_v
1023 // CHECK3-SAME: () #[[ATTR6:[0-9]+]] comdat {
1024 // CHECK3-NEXT: entry:
1025 // CHECK3-NEXT: [[T_VAR:%.*]] = alloca i32, align 4
1026 // CHECK3-NEXT: [[VEC:%.*]] = alloca [2 x i32], align 4
1027 // CHECK3-NEXT: [[T_VAR_CASTED:%.*]] = alloca i32, align 4
1028 // CHECK3-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [1 x ptr], align 4
1029 // CHECK3-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [1 x ptr], align 4
1030 // CHECK3-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [1 x ptr], align 4
1031 // CHECK3-NEXT: [[TMP:%.*]] = alloca i32, align 4
1032 // CHECK3-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
1033 // CHECK3-NEXT: store i32 0, ptr [[T_VAR]], align 4
1034 // CHECK3-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 4 [[VEC]], ptr align 4 @__const._Z5tmainIiET_v.vec, i32 8, i1 false)
1035 // CHECK3-NEXT: [[TMP0:%.*]] = load i32, ptr [[T_VAR]], align 4
1036 // CHECK3-NEXT: store i32 [[TMP0]], ptr [[T_VAR_CASTED]], align 4
1037 // CHECK3-NEXT: [[TMP1:%.*]] = load i32, ptr [[T_VAR_CASTED]], align 4
1038 // CHECK3-NEXT: [[TMP2:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
1039 // CHECK3-NEXT: store i32 [[TMP1]], ptr [[TMP2]], align 4
1040 // CHECK3-NEXT: [[TMP3:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
1041 // CHECK3-NEXT: store i32 [[TMP1]], ptr [[TMP3]], align 4
1042 // CHECK3-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i32 0, i32 0
1043 // CHECK3-NEXT: store ptr null, ptr [[TMP4]], align 4
1044 // CHECK3-NEXT: [[TMP5:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
1045 // CHECK3-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
1046 // CHECK3-NEXT: [[TMP7:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
1047 // CHECK3-NEXT: store i32 2, ptr [[TMP7]], align 4
1048 // CHECK3-NEXT: [[TMP8:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
1049 // CHECK3-NEXT: store i32 1, ptr [[TMP8]], align 4
1050 // CHECK3-NEXT: [[TMP9:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
1051 // CHECK3-NEXT: store ptr [[TMP5]], ptr [[TMP9]], align 4
1052 // CHECK3-NEXT: [[TMP10:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
1053 // CHECK3-NEXT: store ptr [[TMP6]], ptr [[TMP10]], align 4
1054 // CHECK3-NEXT: [[TMP11:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
1055 // CHECK3-NEXT: store ptr @.offload_sizes.1, ptr [[TMP11]], align 4
1056 // CHECK3-NEXT: [[TMP12:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
1057 // CHECK3-NEXT: store ptr @.offload_maptypes.2, ptr [[TMP12]], align 4
1058 // CHECK3-NEXT: [[TMP13:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
1059 // CHECK3-NEXT: store ptr null, ptr [[TMP13]], align 4
1060 // CHECK3-NEXT: [[TMP14:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
1061 // CHECK3-NEXT: store ptr null, ptr [[TMP14]], align 4
1062 // CHECK3-NEXT: [[TMP15:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
1063 // CHECK3-NEXT: store i64 2, ptr [[TMP15]], align 8
1064 // CHECK3-NEXT: [[TMP16:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
1065 // CHECK3-NEXT: store i64 0, ptr [[TMP16]], align 8
1066 // CHECK3-NEXT: [[TMP17:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
1067 // CHECK3-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP17]], align 4
1068 // CHECK3-NEXT: [[TMP18:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
1069 // CHECK3-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP18]], align 4
1070 // CHECK3-NEXT: [[TMP19:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
1071 // CHECK3-NEXT: store i32 0, ptr [[TMP19]], align 4
1072 // CHECK3-NEXT: [[TMP20:%.*]] = 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]])
1073 // CHECK3-NEXT: [[TMP21:%.*]] = icmp ne i32 [[TMP20]], 0
1074 // CHECK3-NEXT: br i1 [[TMP21]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
1075 // CHECK3: omp_offload.failed:
1076 // CHECK3-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32(i32 [[TMP1]]) #[[ATTR3]]
1077 // CHECK3-NEXT: br label [[OMP_OFFLOAD_CONT]]
1078 // CHECK3: omp_offload.cont:
1079 // CHECK3-NEXT: ret i32 0
1082 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32
1083 // CHECK3-SAME: (i32 noundef [[T_VAR:%.*]]) #[[ATTR1]] {
1084 // CHECK3-NEXT: entry:
1085 // CHECK3-NEXT: [[T_VAR_ADDR:%.*]] = alloca i32, align 4
1086 // CHECK3-NEXT: store i32 [[T_VAR]], ptr [[T_VAR_ADDR]], align 4
1087 // 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 [[T_VAR_ADDR]])
1088 // CHECK3-NEXT: ret void
1091 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined
1092 // CHECK3-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[T_VAR:%.*]]) #[[ATTR2]] {
1093 // CHECK3-NEXT: entry:
1094 // CHECK3-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 4
1095 // CHECK3-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 4
1096 // CHECK3-NEXT: [[T_VAR_ADDR:%.*]] = alloca ptr, align 4
1097 // CHECK3-NEXT: [[T_VAR1:%.*]] = alloca i32, align 4
1098 // CHECK3-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
1099 // CHECK3-NEXT: [[TMP:%.*]] = alloca i32, align 4
1100 // CHECK3-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
1101 // CHECK3-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
1102 // CHECK3-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
1103 // CHECK3-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
1104 // CHECK3-NEXT: [[I:%.*]] = alloca i32, align 4
1105 // CHECK3-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 4
1106 // CHECK3-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 4
1107 // CHECK3-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 4
1108 // CHECK3-NEXT: store ptr [[T_VAR]], ptr [[T_VAR_ADDR]], align 4
1109 // CHECK3-NEXT: [[TMP0:%.*]] = load ptr, ptr [[T_VAR_ADDR]], align 4
1110 // CHECK3-NEXT: store i32 0, ptr [[T_VAR1]], align 4
1111 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
1112 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_COMB_UB]], align 4
1113 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
1114 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
1115 // CHECK3-NEXT: [[TMP1:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 4
1116 // CHECK3-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP1]], align 4
1117 // 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)
1118 // CHECK3-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1119 // CHECK3-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP3]], 1
1120 // CHECK3-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
1121 // CHECK3: cond.true:
1122 // CHECK3-NEXT: br label [[COND_END:%.*]]
1123 // CHECK3: cond.false:
1124 // CHECK3-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1125 // CHECK3-NEXT: br label [[COND_END]]
1126 // CHECK3: cond.end:
1127 // CHECK3-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP4]], [[COND_FALSE]] ]
1128 // CHECK3-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
1129 // CHECK3-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
1130 // CHECK3-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_IV]], align 4
1131 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
1132 // CHECK3: omp.inner.for.cond:
1133 // CHECK3-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP15:![0-9]+]]
1134 // CHECK3-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4, !llvm.access.group [[ACC_GRP15]]
1135 // CHECK3-NEXT: [[CMP2:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
1136 // CHECK3-NEXT: br i1 [[CMP2]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
1137 // CHECK3: omp.inner.for.body:
1138 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4, !llvm.access.group [[ACC_GRP15]]
1139 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4, !llvm.access.group [[ACC_GRP15]]
1140 // 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]]), !llvm.access.group [[ACC_GRP15]]
1141 // CHECK3-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
1142 // CHECK3: omp.inner.for.inc:
1143 // CHECK3-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP15]]
1144 // CHECK3-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_STRIDE]], align 4, !llvm.access.group [[ACC_GRP15]]
1145 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP10]], [[TMP11]]
1146 // CHECK3-NEXT: store i32 [[ADD]], ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP15]]
1147 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND]], !llvm.loop [[LOOP16:![0-9]+]]
1148 // CHECK3: omp.inner.for.end:
1149 // CHECK3-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
1150 // CHECK3: omp.loop.exit:
1151 // CHECK3-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP2]])
1152 // CHECK3-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_IS_LAST]], align 4
1153 // CHECK3-NEXT: [[TMP13:%.*]] = icmp ne i32 [[TMP12]], 0
1154 // CHECK3-NEXT: br i1 [[TMP13]], label [[DOTOMP_FINAL_THEN:%.*]], label [[DOTOMP_FINAL_DONE:%.*]]
1155 // CHECK3: .omp.final.then:
1156 // CHECK3-NEXT: store i32 2, ptr [[I]], align 4
1157 // CHECK3-NEXT: br label [[DOTOMP_FINAL_DONE]]
1158 // CHECK3: .omp.final.done:
1159 // CHECK3-NEXT: [[TMP14:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i32 0, i32 0
1160 // CHECK3-NEXT: store ptr [[T_VAR1]], ptr [[TMP14]], align 4
1161 // CHECK3-NEXT: [[TMP15:%.*]] = 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)
1162 // CHECK3-NEXT: switch i32 [[TMP15]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
1163 // CHECK3-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
1164 // CHECK3-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
1165 // CHECK3-NEXT: ]
1166 // CHECK3: .omp.reduction.case1:
1167 // CHECK3-NEXT: [[TMP16:%.*]] = load i32, ptr [[TMP0]], align 4
1168 // CHECK3-NEXT: [[TMP17:%.*]] = load i32, ptr [[T_VAR1]], align 4
1169 // CHECK3-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP16]], [[TMP17]]
1170 // CHECK3-NEXT: store i32 [[ADD3]], ptr [[TMP0]], align 4
1171 // CHECK3-NEXT: call void @__kmpc_end_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP2]], ptr @.gomp_critical_user_.reduction.var)
1172 // CHECK3-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
1173 // CHECK3: .omp.reduction.case2:
1174 // CHECK3-NEXT: [[TMP18:%.*]] = load i32, ptr [[T_VAR1]], align 4
1175 // CHECK3-NEXT: [[TMP19:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP18]] monotonic, align 4
1176 // CHECK3-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
1177 // CHECK3: .omp.reduction.default:
1178 // CHECK3-NEXT: ret void
1181 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined.omp_outlined
1182 // 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:%.*]]) #[[ATTR2]] {
1183 // CHECK3-NEXT: entry:
1184 // CHECK3-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 4
1185 // CHECK3-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 4
1186 // CHECK3-NEXT: [[DOTPREVIOUS_LB__ADDR:%.*]] = alloca i32, align 4
1187 // CHECK3-NEXT: [[DOTPREVIOUS_UB__ADDR:%.*]] = alloca i32, align 4
1188 // CHECK3-NEXT: [[T_VAR_ADDR:%.*]] = alloca ptr, align 4
1189 // CHECK3-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
1190 // CHECK3-NEXT: [[TMP:%.*]] = alloca i32, align 4
1191 // CHECK3-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
1192 // CHECK3-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
1193 // CHECK3-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
1194 // CHECK3-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
1195 // CHECK3-NEXT: [[T_VAR1:%.*]] = alloca i32, align 4
1196 // CHECK3-NEXT: [[I:%.*]] = alloca i32, align 4
1197 // CHECK3-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 4
1198 // CHECK3-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 4
1199 // CHECK3-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 4
1200 // CHECK3-NEXT: store i32 [[DOTPREVIOUS_LB_]], ptr [[DOTPREVIOUS_LB__ADDR]], align 4
1201 // CHECK3-NEXT: store i32 [[DOTPREVIOUS_UB_]], ptr [[DOTPREVIOUS_UB__ADDR]], align 4
1202 // CHECK3-NEXT: store ptr [[T_VAR]], ptr [[T_VAR_ADDR]], align 4
1203 // CHECK3-NEXT: [[TMP0:%.*]] = load ptr, ptr [[T_VAR_ADDR]], align 4
1204 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
1205 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_UB]], align 4
1206 // CHECK3-NEXT: [[TMP1:%.*]] = load i32, ptr [[DOTPREVIOUS_LB__ADDR]], align 4
1207 // CHECK3-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTPREVIOUS_UB__ADDR]], align 4
1208 // CHECK3-NEXT: store i32 [[TMP1]], ptr [[DOTOMP_LB]], align 4
1209 // CHECK3-NEXT: store i32 [[TMP2]], ptr [[DOTOMP_UB]], align 4
1210 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
1211 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
1212 // CHECK3-NEXT: store i32 0, ptr [[T_VAR1]], align 4
1213 // CHECK3-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 4
1214 // CHECK3-NEXT: [[TMP4:%.*]] = load i32, ptr [[TMP3]], align 4
1215 // 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)
1216 // CHECK3-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
1217 // CHECK3-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP5]], 1
1218 // CHECK3-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
1219 // CHECK3: cond.true:
1220 // CHECK3-NEXT: br label [[COND_END:%.*]]
1221 // CHECK3: cond.false:
1222 // CHECK3-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
1223 // CHECK3-NEXT: br label [[COND_END]]
1224 // CHECK3: cond.end:
1225 // CHECK3-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP6]], [[COND_FALSE]] ]
1226 // CHECK3-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
1227 // CHECK3-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
1228 // CHECK3-NEXT: store i32 [[TMP7]], ptr [[DOTOMP_IV]], align 4
1229 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
1230 // CHECK3: omp.inner.for.cond:
1231 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP18:![0-9]+]]
1232 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4, !llvm.access.group [[ACC_GRP18]]
1233 // CHECK3-NEXT: [[CMP2:%.*]] = icmp sle i32 [[TMP8]], [[TMP9]]
1234 // CHECK3-NEXT: br i1 [[CMP2]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
1235 // CHECK3: omp.inner.for.body:
1236 // CHECK3-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP18]]
1237 // CHECK3-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP10]], 1
1238 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
1239 // CHECK3-NEXT: store i32 [[ADD]], ptr [[I]], align 4, !llvm.access.group [[ACC_GRP18]]
1240 // CHECK3-NEXT: [[TMP11:%.*]] = load i32, ptr [[I]], align 4, !llvm.access.group [[ACC_GRP18]]
1241 // CHECK3-NEXT: [[TMP12:%.*]] = load i32, ptr [[T_VAR1]], align 4, !llvm.access.group [[ACC_GRP18]]
1242 // CHECK3-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP12]], [[TMP11]]
1243 // CHECK3-NEXT: store i32 [[ADD3]], ptr [[T_VAR1]], align 4, !llvm.access.group [[ACC_GRP18]]
1244 // CHECK3-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
1245 // CHECK3: omp.body.continue:
1246 // CHECK3-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
1247 // CHECK3: omp.inner.for.inc:
1248 // CHECK3-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP18]]
1249 // CHECK3-NEXT: [[ADD4:%.*]] = add nsw i32 [[TMP13]], 1
1250 // CHECK3-NEXT: store i32 [[ADD4]], ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP18]]
1251 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND]], !llvm.loop [[LOOP19:![0-9]+]]
1252 // CHECK3: omp.inner.for.end:
1253 // CHECK3-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
1254 // CHECK3: omp.loop.exit:
1255 // CHECK3-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP4]])
1256 // CHECK3-NEXT: [[TMP14:%.*]] = load i32, ptr [[DOTOMP_IS_LAST]], align 4
1257 // CHECK3-NEXT: [[TMP15:%.*]] = icmp ne i32 [[TMP14]], 0
1258 // CHECK3-NEXT: br i1 [[TMP15]], label [[DOTOMP_FINAL_THEN:%.*]], label [[DOTOMP_FINAL_DONE:%.*]]
1259 // CHECK3: .omp.final.then:
1260 // CHECK3-NEXT: store i32 2, ptr [[I]], align 4
1261 // CHECK3-NEXT: br label [[DOTOMP_FINAL_DONE]]
1262 // CHECK3: .omp.final.done:
1263 // CHECK3-NEXT: [[TMP16:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i32 0, i32 0
1264 // CHECK3-NEXT: store ptr [[T_VAR1]], ptr [[TMP16]], align 4
1265 // CHECK3-NEXT: [[TMP17:%.*]] = 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)
1266 // CHECK3-NEXT: switch i32 [[TMP17]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
1267 // CHECK3-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
1268 // CHECK3-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
1269 // CHECK3-NEXT: ]
1270 // CHECK3: .omp.reduction.case1:
1271 // CHECK3-NEXT: [[TMP18:%.*]] = load i32, ptr [[TMP0]], align 4
1272 // CHECK3-NEXT: [[TMP19:%.*]] = load i32, ptr [[T_VAR1]], align 4
1273 // CHECK3-NEXT: [[ADD5:%.*]] = add nsw i32 [[TMP18]], [[TMP19]]
1274 // CHECK3-NEXT: store i32 [[ADD5]], ptr [[TMP0]], align 4
1275 // CHECK3-NEXT: call void @__kmpc_end_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP4]], ptr @.gomp_critical_user_.reduction.var)
1276 // CHECK3-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
1277 // CHECK3: .omp.reduction.case2:
1278 // CHECK3-NEXT: [[TMP20:%.*]] = load i32, ptr [[T_VAR1]], align 4
1279 // CHECK3-NEXT: [[TMP21:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP20]] monotonic, align 4
1280 // CHECK3-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
1281 // CHECK3: .omp.reduction.default:
1282 // CHECK3-NEXT: ret void
1285 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined.omp_outlined.omp.reduction.reduction_func
1286 // CHECK3-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR4]] {
1287 // CHECK3-NEXT: entry:
1288 // CHECK3-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 4
1289 // CHECK3-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 4
1290 // CHECK3-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 4
1291 // CHECK3-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 4
1292 // CHECK3-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 4
1293 // CHECK3-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 4
1294 // CHECK3-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i32 0, i32 0
1295 // CHECK3-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 4
1296 // CHECK3-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i32 0, i32 0
1297 // CHECK3-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 4
1298 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
1299 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
1300 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
1301 // CHECK3-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
1302 // CHECK3-NEXT: ret void
1305 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l32.omp_outlined.omp.reduction.reduction_func
1306 // CHECK3-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR4]] {
1307 // CHECK3-NEXT: entry:
1308 // CHECK3-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 4
1309 // CHECK3-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 4
1310 // CHECK3-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 4
1311 // CHECK3-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 4
1312 // CHECK3-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 4
1313 // CHECK3-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 4
1314 // CHECK3-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i32 0, i32 0
1315 // CHECK3-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 4
1316 // CHECK3-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i32 0, i32 0
1317 // CHECK3-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 4
1318 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
1319 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
1320 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
1321 // CHECK3-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
1322 // CHECK3-NEXT: ret void
1325 // CHECK3-LABEL: define {{[^@]+}}@.omp_offloading.requires_reg
1326 // CHECK3-SAME: () #[[ATTR8:[0-9]+]] {
1327 // CHECK3-NEXT: entry:
1328 // CHECK3-NEXT: call void @__tgt_register_requires(i64 1)
1329 // CHECK3-NEXT: ret void
1332 // CHECK5-LABEL: define {{[^@]+}}@main
1333 // CHECK5-SAME: () #[[ATTR0:[0-9]+]] {
1334 // CHECK5-NEXT: entry:
1335 // CHECK5-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
1336 // CHECK5-NEXT: [[TMP:%.*]] = alloca i32, align 4
1337 // CHECK5-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
1338 // CHECK5-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
1339 // CHECK5-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
1340 // CHECK5-NEXT: [[I:%.*]] = alloca i32, align 4
1341 // CHECK5-NEXT: [[SIVAR:%.*]] = alloca i32, align 4
1342 // CHECK5-NEXT: store i32 0, ptr [[RETVAL]], align 4
1343 // CHECK5-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
1344 // CHECK5-NEXT: store i32 1, ptr [[DOTOMP_UB]], align 4
1345 // CHECK5-NEXT: [[TMP0:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
1346 // CHECK5-NEXT: store i32 [[TMP0]], ptr [[DOTOMP_IV]], align 4
1347 // CHECK5-NEXT: store i32 0, ptr [[SIVAR]], align 4
1348 // CHECK5-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
1349 // CHECK5: omp.inner.for.cond:
1350 // CHECK5-NEXT: [[TMP1:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP2:![0-9]+]]
1351 // CHECK5-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4, !llvm.access.group [[ACC_GRP2]]
1352 // CHECK5-NEXT: [[CMP:%.*]] = icmp sle i32 [[TMP1]], [[TMP2]]
1353 // CHECK5-NEXT: br i1 [[CMP]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
1354 // CHECK5: omp.inner.for.body:
1355 // CHECK5-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP2]]
1356 // CHECK5-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP3]], 1
1357 // CHECK5-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
1358 // CHECK5-NEXT: store i32 [[ADD]], ptr [[I]], align 4, !llvm.access.group [[ACC_GRP2]]
1359 // CHECK5-NEXT: [[TMP4:%.*]] = load i32, ptr [[I]], align 4, !llvm.access.group [[ACC_GRP2]]
1360 // CHECK5-NEXT: [[TMP5:%.*]] = load i32, ptr [[SIVAR]], align 4, !llvm.access.group [[ACC_GRP2]]
1361 // CHECK5-NEXT: [[ADD1:%.*]] = add nsw i32 [[TMP5]], [[TMP4]]
1362 // CHECK5-NEXT: store i32 [[ADD1]], ptr [[SIVAR]], align 4, !llvm.access.group [[ACC_GRP2]]
1363 // CHECK5-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
1364 // CHECK5: omp.body.continue:
1365 // CHECK5-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
1366 // CHECK5: omp.inner.for.inc:
1367 // CHECK5-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP2]]
1368 // CHECK5-NEXT: [[ADD2:%.*]] = add nsw i32 [[TMP6]], 1
1369 // CHECK5-NEXT: store i32 [[ADD2]], ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP2]]
1370 // CHECK5-NEXT: br label [[OMP_INNER_FOR_COND]], !llvm.loop [[LOOP3:![0-9]+]]
1371 // CHECK5: omp.inner.for.end:
1372 // CHECK5-NEXT: store i32 2, ptr [[I]], align 4
1373 // CHECK5-NEXT: [[TMP7:%.*]] = load i32, ptr @_ZZ4mainE5sivar, align 4
1374 // CHECK5-NEXT: [[TMP8:%.*]] = load i32, ptr [[SIVAR]], align 4
1375 // CHECK5-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP7]], [[TMP8]]
1376 // CHECK5-NEXT: store i32 [[ADD3]], ptr @_ZZ4mainE5sivar, align 4
1377 // CHECK5-NEXT: [[CALL:%.*]] = call noundef signext i32 @_Z5tmainIiET_v()
1378 // CHECK5-NEXT: ret i32 [[CALL]]
1381 // CHECK5-LABEL: define {{[^@]+}}@_Z5tmainIiET_v
1382 // CHECK5-SAME: () #[[ATTR1:[0-9]+]] comdat {
1383 // CHECK5-NEXT: entry:
1384 // CHECK5-NEXT: [[T_VAR:%.*]] = alloca i32, align 4
1385 // CHECK5-NEXT: [[VEC:%.*]] = alloca [2 x i32], align 4
1386 // CHECK5-NEXT: [[TMP:%.*]] = alloca i32, align 4
1387 // CHECK5-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
1388 // CHECK5-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
1389 // CHECK5-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
1390 // CHECK5-NEXT: [[I:%.*]] = alloca i32, align 4
1391 // CHECK5-NEXT: [[T_VAR1:%.*]] = alloca i32, align 4
1392 // CHECK5-NEXT: store i32 0, ptr [[T_VAR]], align 4
1393 // CHECK5-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[VEC]], ptr align 4 @__const._Z5tmainIiET_v.vec, i64 8, i1 false)
1394 // CHECK5-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
1395 // CHECK5-NEXT: store i32 1, ptr [[DOTOMP_UB]], align 4
1396 // CHECK5-NEXT: [[TMP0:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
1397 // CHECK5-NEXT: store i32 [[TMP0]], ptr [[DOTOMP_IV]], align 4
1398 // CHECK5-NEXT: store i32 0, ptr [[T_VAR1]], align 4
1399 // CHECK5-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
1400 // CHECK5: omp.inner.for.cond:
1401 // CHECK5-NEXT: [[TMP1:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP6:![0-9]+]]
1402 // CHECK5-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4, !llvm.access.group [[ACC_GRP6]]
1403 // CHECK5-NEXT: [[CMP:%.*]] = icmp sle i32 [[TMP1]], [[TMP2]]
1404 // CHECK5-NEXT: br i1 [[CMP]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
1405 // CHECK5: omp.inner.for.body:
1406 // CHECK5-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP6]]
1407 // CHECK5-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP3]], 1
1408 // CHECK5-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
1409 // CHECK5-NEXT: store i32 [[ADD]], ptr [[I]], align 4, !llvm.access.group [[ACC_GRP6]]
1410 // CHECK5-NEXT: [[TMP4:%.*]] = load i32, ptr [[I]], align 4, !llvm.access.group [[ACC_GRP6]]
1411 // CHECK5-NEXT: [[TMP5:%.*]] = load i32, ptr [[T_VAR1]], align 4, !llvm.access.group [[ACC_GRP6]]
1412 // CHECK5-NEXT: [[ADD2:%.*]] = add nsw i32 [[TMP5]], [[TMP4]]
1413 // CHECK5-NEXT: store i32 [[ADD2]], ptr [[T_VAR1]], align 4, !llvm.access.group [[ACC_GRP6]]
1414 // CHECK5-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
1415 // CHECK5: omp.body.continue:
1416 // CHECK5-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
1417 // CHECK5: omp.inner.for.inc:
1418 // CHECK5-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP6]]
1419 // CHECK5-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP6]], 1
1420 // CHECK5-NEXT: store i32 [[ADD3]], ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP6]]
1421 // CHECK5-NEXT: br label [[OMP_INNER_FOR_COND]], !llvm.loop [[LOOP7:![0-9]+]]
1422 // CHECK5: omp.inner.for.end:
1423 // CHECK5-NEXT: store i32 2, ptr [[I]], align 4
1424 // CHECK5-NEXT: [[TMP7:%.*]] = load i32, ptr [[T_VAR]], align 4
1425 // CHECK5-NEXT: [[TMP8:%.*]] = load i32, ptr [[T_VAR1]], align 4
1426 // CHECK5-NEXT: [[ADD4:%.*]] = add nsw i32 [[TMP7]], [[TMP8]]
1427 // CHECK5-NEXT: store i32 [[ADD4]], ptr [[T_VAR]], align 4
1428 // CHECK5-NEXT: ret i32 0
1431 // CHECK7-LABEL: define {{[^@]+}}@main
1432 // CHECK7-SAME: () #[[ATTR0:[0-9]+]] {
1433 // CHECK7-NEXT: entry:
1434 // CHECK7-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
1435 // CHECK7-NEXT: [[TMP:%.*]] = alloca i32, align 4
1436 // CHECK7-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
1437 // CHECK7-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
1438 // CHECK7-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
1439 // CHECK7-NEXT: [[I:%.*]] = alloca i32, align 4
1440 // CHECK7-NEXT: [[SIVAR:%.*]] = alloca i32, align 4
1441 // CHECK7-NEXT: store i32 0, ptr [[RETVAL]], align 4
1442 // CHECK7-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
1443 // CHECK7-NEXT: store i32 1, ptr [[DOTOMP_UB]], align 4
1444 // CHECK7-NEXT: [[TMP0:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
1445 // CHECK7-NEXT: store i32 [[TMP0]], ptr [[DOTOMP_IV]], align 4
1446 // CHECK7-NEXT: store i32 0, ptr [[SIVAR]], align 4
1447 // CHECK7-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
1448 // CHECK7: omp.inner.for.cond:
1449 // CHECK7-NEXT: [[TMP1:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP3:![0-9]+]]
1450 // CHECK7-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4, !llvm.access.group [[ACC_GRP3]]
1451 // CHECK7-NEXT: [[CMP:%.*]] = icmp sle i32 [[TMP1]], [[TMP2]]
1452 // CHECK7-NEXT: br i1 [[CMP]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
1453 // CHECK7: omp.inner.for.body:
1454 // CHECK7-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP3]]
1455 // CHECK7-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP3]], 1
1456 // CHECK7-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
1457 // CHECK7-NEXT: store i32 [[ADD]], ptr [[I]], align 4, !llvm.access.group [[ACC_GRP3]]
1458 // CHECK7-NEXT: [[TMP4:%.*]] = load i32, ptr [[I]], align 4, !llvm.access.group [[ACC_GRP3]]
1459 // CHECK7-NEXT: [[TMP5:%.*]] = load i32, ptr [[SIVAR]], align 4, !llvm.access.group [[ACC_GRP3]]
1460 // CHECK7-NEXT: [[ADD1:%.*]] = add nsw i32 [[TMP5]], [[TMP4]]
1461 // CHECK7-NEXT: store i32 [[ADD1]], ptr [[SIVAR]], align 4, !llvm.access.group [[ACC_GRP3]]
1462 // CHECK7-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
1463 // CHECK7: omp.body.continue:
1464 // CHECK7-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
1465 // CHECK7: omp.inner.for.inc:
1466 // CHECK7-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP3]]
1467 // CHECK7-NEXT: [[ADD2:%.*]] = add nsw i32 [[TMP6]], 1
1468 // CHECK7-NEXT: store i32 [[ADD2]], ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP3]]
1469 // CHECK7-NEXT: br label [[OMP_INNER_FOR_COND]], !llvm.loop [[LOOP4:![0-9]+]]
1470 // CHECK7: omp.inner.for.end:
1471 // CHECK7-NEXT: store i32 2, ptr [[I]], align 4
1472 // CHECK7-NEXT: [[TMP7:%.*]] = load i32, ptr @_ZZ4mainE5sivar, align 4
1473 // CHECK7-NEXT: [[TMP8:%.*]] = load i32, ptr [[SIVAR]], align 4
1474 // CHECK7-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP7]], [[TMP8]]
1475 // CHECK7-NEXT: store i32 [[ADD3]], ptr @_ZZ4mainE5sivar, align 4
1476 // CHECK7-NEXT: [[CALL:%.*]] = call noundef i32 @_Z5tmainIiET_v()
1477 // CHECK7-NEXT: ret i32 [[CALL]]
1480 // CHECK7-LABEL: define {{[^@]+}}@_Z5tmainIiET_v
1481 // CHECK7-SAME: () #[[ATTR1:[0-9]+]] comdat {
1482 // CHECK7-NEXT: entry:
1483 // CHECK7-NEXT: [[T_VAR:%.*]] = alloca i32, align 4
1484 // CHECK7-NEXT: [[VEC:%.*]] = alloca [2 x i32], align 4
1485 // CHECK7-NEXT: [[TMP:%.*]] = alloca i32, align 4
1486 // CHECK7-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
1487 // CHECK7-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
1488 // CHECK7-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
1489 // CHECK7-NEXT: [[I:%.*]] = alloca i32, align 4
1490 // CHECK7-NEXT: [[T_VAR1:%.*]] = alloca i32, align 4
1491 // CHECK7-NEXT: store i32 0, ptr [[T_VAR]], align 4
1492 // CHECK7-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 4 [[VEC]], ptr align 4 @__const._Z5tmainIiET_v.vec, i32 8, i1 false)
1493 // CHECK7-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
1494 // CHECK7-NEXT: store i32 1, ptr [[DOTOMP_UB]], align 4
1495 // CHECK7-NEXT: [[TMP0:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
1496 // CHECK7-NEXT: store i32 [[TMP0]], ptr [[DOTOMP_IV]], align 4
1497 // CHECK7-NEXT: store i32 0, ptr [[T_VAR1]], align 4
1498 // CHECK7-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
1499 // CHECK7: omp.inner.for.cond:
1500 // CHECK7-NEXT: [[TMP1:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP7:![0-9]+]]
1501 // CHECK7-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4, !llvm.access.group [[ACC_GRP7]]
1502 // CHECK7-NEXT: [[CMP:%.*]] = icmp sle i32 [[TMP1]], [[TMP2]]
1503 // CHECK7-NEXT: br i1 [[CMP]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
1504 // CHECK7: omp.inner.for.body:
1505 // CHECK7-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP7]]
1506 // CHECK7-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP3]], 1
1507 // CHECK7-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
1508 // CHECK7-NEXT: store i32 [[ADD]], ptr [[I]], align 4, !llvm.access.group [[ACC_GRP7]]
1509 // CHECK7-NEXT: [[TMP4:%.*]] = load i32, ptr [[I]], align 4, !llvm.access.group [[ACC_GRP7]]
1510 // CHECK7-NEXT: [[TMP5:%.*]] = load i32, ptr [[T_VAR1]], align 4, !llvm.access.group [[ACC_GRP7]]
1511 // CHECK7-NEXT: [[ADD2:%.*]] = add nsw i32 [[TMP5]], [[TMP4]]
1512 // CHECK7-NEXT: store i32 [[ADD2]], ptr [[T_VAR1]], align 4, !llvm.access.group [[ACC_GRP7]]
1513 // CHECK7-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
1514 // CHECK7: omp.body.continue:
1515 // CHECK7-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
1516 // CHECK7: omp.inner.for.inc:
1517 // CHECK7-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP7]]
1518 // CHECK7-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP6]], 1
1519 // CHECK7-NEXT: store i32 [[ADD3]], ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP7]]
1520 // CHECK7-NEXT: br label [[OMP_INNER_FOR_COND]], !llvm.loop [[LOOP8:![0-9]+]]
1521 // CHECK7: omp.inner.for.end:
1522 // CHECK7-NEXT: store i32 2, ptr [[I]], align 4
1523 // CHECK7-NEXT: [[TMP7:%.*]] = load i32, ptr [[T_VAR]], align 4
1524 // CHECK7-NEXT: [[TMP8:%.*]] = load i32, ptr [[T_VAR1]], align 4
1525 // CHECK7-NEXT: [[ADD4:%.*]] = add nsw i32 [[TMP7]], [[TMP8]]
1526 // CHECK7-NEXT: store i32 [[ADD4]], ptr [[T_VAR]], align 4
1527 // CHECK7-NEXT: ret i32 0
1530 // CHECK9-LABEL: define {{[^@]+}}@main
1531 // CHECK9-SAME: () #[[ATTR0:[0-9]+]] {
1532 // CHECK9-NEXT: entry:
1533 // CHECK9-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
1534 // CHECK9-NEXT: [[REF_TMP:%.*]] = alloca [[CLASS_ANON:%.*]], align 1
1535 // CHECK9-NEXT: store i32 0, ptr [[RETVAL]], align 4
1536 // CHECK9-NEXT: call void @"_ZZ4mainENK3$_0clEv"(ptr noundef nonnull align 1 dereferenceable(1) [[REF_TMP]])
1537 // CHECK9-NEXT: ret i32 0
1540 // CHECK9-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l45
1541 // CHECK9-SAME: (i64 noundef [[SIVAR:%.*]]) #[[ATTR2:[0-9]+]] {
1542 // CHECK9-NEXT: entry:
1543 // CHECK9-NEXT: [[SIVAR_ADDR:%.*]] = alloca i64, align 8
1544 // CHECK9-NEXT: store i64 [[SIVAR]], ptr [[SIVAR_ADDR]], align 8
1545 // CHECK9-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_l45.omp_outlined, ptr [[SIVAR_ADDR]])
1546 // CHECK9-NEXT: ret void
1549 // CHECK9-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l45.omp_outlined
1550 // CHECK9-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[SIVAR:%.*]]) #[[ATTR3:[0-9]+]] {
1551 // CHECK9-NEXT: entry:
1552 // CHECK9-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
1553 // CHECK9-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
1554 // CHECK9-NEXT: [[SIVAR_ADDR:%.*]] = alloca ptr, align 8
1555 // CHECK9-NEXT: [[SIVAR1:%.*]] = alloca i32, align 4
1556 // CHECK9-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
1557 // CHECK9-NEXT: [[TMP:%.*]] = alloca i32, align 4
1558 // CHECK9-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
1559 // CHECK9-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
1560 // CHECK9-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
1561 // CHECK9-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
1562 // CHECK9-NEXT: [[I:%.*]] = alloca i32, align 4
1563 // CHECK9-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 8
1564 // CHECK9-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
1565 // CHECK9-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
1566 // CHECK9-NEXT: store ptr [[SIVAR]], ptr [[SIVAR_ADDR]], align 8
1567 // CHECK9-NEXT: [[TMP0:%.*]] = load ptr, ptr [[SIVAR_ADDR]], align 8
1568 // CHECK9-NEXT: store i32 0, ptr [[SIVAR1]], align 4
1569 // CHECK9-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
1570 // CHECK9-NEXT: store i32 1, ptr [[DOTOMP_COMB_UB]], align 4
1571 // CHECK9-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
1572 // CHECK9-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
1573 // CHECK9-NEXT: [[TMP1:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
1574 // CHECK9-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP1]], align 4
1575 // CHECK9-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)
1576 // CHECK9-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1577 // CHECK9-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP3]], 1
1578 // CHECK9-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
1579 // CHECK9: cond.true:
1580 // CHECK9-NEXT: br label [[COND_END:%.*]]
1581 // CHECK9: cond.false:
1582 // CHECK9-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1583 // CHECK9-NEXT: br label [[COND_END]]
1584 // CHECK9: cond.end:
1585 // CHECK9-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP4]], [[COND_FALSE]] ]
1586 // CHECK9-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
1587 // CHECK9-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
1588 // CHECK9-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_IV]], align 4
1589 // CHECK9-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
1590 // CHECK9: omp.inner.for.cond:
1591 // CHECK9-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP4:![0-9]+]]
1592 // CHECK9-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4, !llvm.access.group [[ACC_GRP4]]
1593 // CHECK9-NEXT: [[CMP2:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
1594 // CHECK9-NEXT: br i1 [[CMP2]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
1595 // CHECK9: omp.inner.for.body:
1596 // CHECK9-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4, !llvm.access.group [[ACC_GRP4]]
1597 // CHECK9-NEXT: [[TMP9:%.*]] = zext i32 [[TMP8]] to i64
1598 // CHECK9-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4, !llvm.access.group [[ACC_GRP4]]
1599 // CHECK9-NEXT: [[TMP11:%.*]] = zext i32 [[TMP10]] to i64
1600 // CHECK9-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB4]], i32 3, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l45.omp_outlined.omp_outlined, i64 [[TMP9]], i64 [[TMP11]], ptr [[SIVAR1]]), !llvm.access.group [[ACC_GRP4]]
1601 // CHECK9-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
1602 // CHECK9: omp.inner.for.inc:
1603 // CHECK9-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP4]]
1604 // CHECK9-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_STRIDE]], align 4, !llvm.access.group [[ACC_GRP4]]
1605 // CHECK9-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP12]], [[TMP13]]
1606 // CHECK9-NEXT: store i32 [[ADD]], ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP4]]
1607 // CHECK9-NEXT: br label [[OMP_INNER_FOR_COND]], !llvm.loop [[LOOP5:![0-9]+]]
1608 // CHECK9: omp.inner.for.end:
1609 // CHECK9-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
1610 // CHECK9: omp.loop.exit:
1611 // CHECK9-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP2]])
1612 // CHECK9-NEXT: [[TMP14:%.*]] = load i32, ptr [[DOTOMP_IS_LAST]], align 4
1613 // CHECK9-NEXT: [[TMP15:%.*]] = icmp ne i32 [[TMP14]], 0
1614 // CHECK9-NEXT: br i1 [[TMP15]], label [[DOTOMP_FINAL_THEN:%.*]], label [[DOTOMP_FINAL_DONE:%.*]]
1615 // CHECK9: .omp.final.then:
1616 // CHECK9-NEXT: store i32 2, ptr [[I]], align 4
1617 // CHECK9-NEXT: br label [[DOTOMP_FINAL_DONE]]
1618 // CHECK9: .omp.final.done:
1619 // CHECK9-NEXT: [[TMP16:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i64 0, i64 0
1620 // CHECK9-NEXT: store ptr [[SIVAR1]], ptr [[TMP16]], align 8
1621 // CHECK9-NEXT: [[TMP17:%.*]] = 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_l45.omp_outlined.omp.reduction.reduction_func, ptr @.gomp_critical_user_.reduction.var)
1622 // CHECK9-NEXT: switch i32 [[TMP17]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
1623 // CHECK9-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
1624 // CHECK9-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
1625 // CHECK9-NEXT: ]
1626 // CHECK9: .omp.reduction.case1:
1627 // CHECK9-NEXT: [[TMP18:%.*]] = load i32, ptr [[TMP0]], align 4
1628 // CHECK9-NEXT: [[TMP19:%.*]] = load i32, ptr [[SIVAR1]], align 4
1629 // CHECK9-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP18]], [[TMP19]]
1630 // CHECK9-NEXT: store i32 [[ADD3]], ptr [[TMP0]], align 4
1631 // CHECK9-NEXT: call void @__kmpc_end_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP2]], ptr @.gomp_critical_user_.reduction.var)
1632 // CHECK9-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
1633 // CHECK9: .omp.reduction.case2:
1634 // CHECK9-NEXT: [[TMP20:%.*]] = load i32, ptr [[SIVAR1]], align 4
1635 // CHECK9-NEXT: [[TMP21:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP20]] monotonic, align 4
1636 // CHECK9-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
1637 // CHECK9: .omp.reduction.default:
1638 // CHECK9-NEXT: ret void
1641 // CHECK9-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l45.omp_outlined.omp_outlined
1642 // CHECK9-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:%.*]]) #[[ATTR3]] {
1643 // CHECK9-NEXT: entry:
1644 // CHECK9-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
1645 // CHECK9-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
1646 // CHECK9-NEXT: [[DOTPREVIOUS_LB__ADDR:%.*]] = alloca i64, align 8
1647 // CHECK9-NEXT: [[DOTPREVIOUS_UB__ADDR:%.*]] = alloca i64, align 8
1648 // CHECK9-NEXT: [[SIVAR_ADDR:%.*]] = alloca ptr, align 8
1649 // CHECK9-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
1650 // CHECK9-NEXT: [[TMP:%.*]] = alloca i32, align 4
1651 // CHECK9-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
1652 // CHECK9-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
1653 // CHECK9-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
1654 // CHECK9-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
1655 // CHECK9-NEXT: [[SIVAR2:%.*]] = alloca i32, align 4
1656 // CHECK9-NEXT: [[I:%.*]] = alloca i32, align 4
1657 // CHECK9-NEXT: [[REF_TMP:%.*]] = alloca [[CLASS_ANON_0:%.*]], align 8
1658 // CHECK9-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 8
1659 // CHECK9-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
1660 // CHECK9-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
1661 // CHECK9-NEXT: store i64 [[DOTPREVIOUS_LB_]], ptr [[DOTPREVIOUS_LB__ADDR]], align 8
1662 // CHECK9-NEXT: store i64 [[DOTPREVIOUS_UB_]], ptr [[DOTPREVIOUS_UB__ADDR]], align 8
1663 // CHECK9-NEXT: store ptr [[SIVAR]], ptr [[SIVAR_ADDR]], align 8
1664 // CHECK9-NEXT: [[TMP0:%.*]] = load ptr, ptr [[SIVAR_ADDR]], align 8
1665 // CHECK9-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
1666 // CHECK9-NEXT: store i32 1, ptr [[DOTOMP_UB]], align 4
1667 // CHECK9-NEXT: [[TMP1:%.*]] = load i64, ptr [[DOTPREVIOUS_LB__ADDR]], align 8
1668 // CHECK9-NEXT: [[CONV:%.*]] = trunc i64 [[TMP1]] to i32
1669 // CHECK9-NEXT: [[TMP2:%.*]] = load i64, ptr [[DOTPREVIOUS_UB__ADDR]], align 8
1670 // CHECK9-NEXT: [[CONV1:%.*]] = trunc i64 [[TMP2]] to i32
1671 // CHECK9-NEXT: store i32 [[CONV]], ptr [[DOTOMP_LB]], align 4
1672 // CHECK9-NEXT: store i32 [[CONV1]], ptr [[DOTOMP_UB]], align 4
1673 // CHECK9-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
1674 // CHECK9-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
1675 // CHECK9-NEXT: store i32 0, ptr [[SIVAR2]], align 4
1676 // CHECK9-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
1677 // CHECK9-NEXT: [[TMP4:%.*]] = load i32, ptr [[TMP3]], align 4
1678 // CHECK9-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)
1679 // CHECK9-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
1680 // CHECK9-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP5]], 1
1681 // CHECK9-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
1682 // CHECK9: cond.true:
1683 // CHECK9-NEXT: br label [[COND_END:%.*]]
1684 // CHECK9: cond.false:
1685 // CHECK9-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
1686 // CHECK9-NEXT: br label [[COND_END]]
1687 // CHECK9: cond.end:
1688 // CHECK9-NEXT: [[COND:%.*]] = phi i32 [ 1, [[COND_TRUE]] ], [ [[TMP6]], [[COND_FALSE]] ]
1689 // CHECK9-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
1690 // CHECK9-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
1691 // CHECK9-NEXT: store i32 [[TMP7]], ptr [[DOTOMP_IV]], align 4
1692 // CHECK9-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
1693 // CHECK9: omp.inner.for.cond:
1694 // CHECK9-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP8:![0-9]+]]
1695 // CHECK9-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4, !llvm.access.group [[ACC_GRP8]]
1696 // CHECK9-NEXT: [[CMP3:%.*]] = icmp sle i32 [[TMP8]], [[TMP9]]
1697 // CHECK9-NEXT: br i1 [[CMP3]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
1698 // CHECK9: omp.inner.for.body:
1699 // CHECK9-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP8]]
1700 // CHECK9-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP10]], 1
1701 // CHECK9-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
1702 // CHECK9-NEXT: store i32 [[ADD]], ptr [[I]], align 4, !llvm.access.group [[ACC_GRP8]]
1703 // CHECK9-NEXT: [[TMP11:%.*]] = load i32, ptr [[I]], align 4, !llvm.access.group [[ACC_GRP8]]
1704 // CHECK9-NEXT: [[TMP12:%.*]] = load i32, ptr [[SIVAR2]], align 4, !llvm.access.group [[ACC_GRP8]]
1705 // CHECK9-NEXT: [[ADD4:%.*]] = add nsw i32 [[TMP12]], [[TMP11]]
1706 // CHECK9-NEXT: store i32 [[ADD4]], ptr [[SIVAR2]], align 4, !llvm.access.group [[ACC_GRP8]]
1707 // CHECK9-NEXT: [[TMP13:%.*]] = getelementptr inbounds [[CLASS_ANON_0]], ptr [[REF_TMP]], i32 0, i32 0
1708 // CHECK9-NEXT: store ptr [[SIVAR2]], ptr [[TMP13]], align 8, !llvm.access.group [[ACC_GRP8]]
1709 // CHECK9-NEXT: call void @"_ZZZ4mainENK3$_0clEvENKUlvE_clEv"(ptr noundef nonnull align 8 dereferenceable(8) [[REF_TMP]]), !llvm.access.group [[ACC_GRP8]]
1710 // CHECK9-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
1711 // CHECK9: omp.body.continue:
1712 // CHECK9-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
1713 // CHECK9: omp.inner.for.inc:
1714 // CHECK9-NEXT: [[TMP14:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP8]]
1715 // CHECK9-NEXT: [[ADD5:%.*]] = add nsw i32 [[TMP14]], 1
1716 // CHECK9-NEXT: store i32 [[ADD5]], ptr [[DOTOMP_IV]], align 4, !llvm.access.group [[ACC_GRP8]]
1717 // CHECK9-NEXT: br label [[OMP_INNER_FOR_COND]], !llvm.loop [[LOOP9:![0-9]+]]
1718 // CHECK9: omp.inner.for.end:
1719 // CHECK9-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
1720 // CHECK9: omp.loop.exit:
1721 // CHECK9-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP4]])
1722 // CHECK9-NEXT: [[TMP15:%.*]] = load i32, ptr [[DOTOMP_IS_LAST]], align 4
1723 // CHECK9-NEXT: [[TMP16:%.*]] = icmp ne i32 [[TMP15]], 0
1724 // CHECK9-NEXT: br i1 [[TMP16]], label [[DOTOMP_FINAL_THEN:%.*]], label [[DOTOMP_FINAL_DONE:%.*]]
1725 // CHECK9: .omp.final.then:
1726 // CHECK9-NEXT: store i32 2, ptr [[I]], align 4
1727 // CHECK9-NEXT: br label [[DOTOMP_FINAL_DONE]]
1728 // CHECK9: .omp.final.done:
1729 // CHECK9-NEXT: [[TMP17:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i64 0, i64 0
1730 // CHECK9-NEXT: store ptr [[SIVAR2]], ptr [[TMP17]], align 8
1731 // CHECK9-NEXT: [[TMP18:%.*]] = 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_l45.omp_outlined.omp_outlined.omp.reduction.reduction_func, ptr @.gomp_critical_user_.reduction.var)
1732 // CHECK9-NEXT: switch i32 [[TMP18]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
1733 // CHECK9-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
1734 // CHECK9-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
1735 // CHECK9-NEXT: ]
1736 // CHECK9: .omp.reduction.case1:
1737 // CHECK9-NEXT: [[TMP19:%.*]] = load i32, ptr [[TMP0]], align 4
1738 // CHECK9-NEXT: [[TMP20:%.*]] = load i32, ptr [[SIVAR2]], align 4
1739 // CHECK9-NEXT: [[ADD6:%.*]] = add nsw i32 [[TMP19]], [[TMP20]]
1740 // CHECK9-NEXT: store i32 [[ADD6]], ptr [[TMP0]], align 4
1741 // CHECK9-NEXT: call void @__kmpc_end_reduce_nowait(ptr @[[GLOB3]], i32 [[TMP4]], ptr @.gomp_critical_user_.reduction.var)
1742 // CHECK9-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
1743 // CHECK9: .omp.reduction.case2:
1744 // CHECK9-NEXT: [[TMP21:%.*]] = load i32, ptr [[SIVAR2]], align 4
1745 // CHECK9-NEXT: [[TMP22:%.*]] = atomicrmw add ptr [[TMP0]], i32 [[TMP21]] monotonic, align 4
1746 // CHECK9-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
1747 // CHECK9: .omp.reduction.default:
1748 // CHECK9-NEXT: ret void
1751 // CHECK9-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l45.omp_outlined.omp_outlined.omp.reduction.reduction_func
1752 // CHECK9-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR5:[0-9]+]] {
1753 // CHECK9-NEXT: entry:
1754 // CHECK9-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 8
1755 // CHECK9-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 8
1756 // CHECK9-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 8
1757 // CHECK9-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 8
1758 // CHECK9-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 8
1759 // CHECK9-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 8
1760 // CHECK9-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i64 0, i64 0
1761 // CHECK9-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 8
1762 // CHECK9-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i64 0, i64 0
1763 // CHECK9-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 8
1764 // CHECK9-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
1765 // CHECK9-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
1766 // CHECK9-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
1767 // CHECK9-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
1768 // CHECK9-NEXT: ret void
1771 // CHECK9-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l45.omp_outlined.omp.reduction.reduction_func
1772 // CHECK9-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR5]] {
1773 // CHECK9-NEXT: entry:
1774 // CHECK9-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 8
1775 // CHECK9-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 8
1776 // CHECK9-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 8
1777 // CHECK9-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 8
1778 // CHECK9-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 8
1779 // CHECK9-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 8
1780 // CHECK9-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i64 0, i64 0
1781 // CHECK9-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 8
1782 // CHECK9-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i64 0, i64 0
1783 // CHECK9-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 8
1784 // CHECK9-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
1785 // CHECK9-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
1786 // CHECK9-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
1787 // CHECK9-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
1788 // CHECK9-NEXT: ret void
1791 // CHECK9-LABEL: define {{[^@]+}}@.omp_offloading.requires_reg
1792 // CHECK9-SAME: () #[[ATTR7:[0-9]+]] {
1793 // CHECK9-NEXT: entry:
1794 // CHECK9-NEXT: call void @__tgt_register_requires(i64 1)
1795 // CHECK9-NEXT: ret void
1798 // CHECK11-LABEL: define {{[^@]+}}@main
1799 // CHECK11-SAME: () #[[ATTR0:[0-9]+]] {
1800 // CHECK11-NEXT: entry:
1801 // CHECK11-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
1802 // CHECK11-NEXT: [[REF_TMP:%.*]] = alloca [[CLASS_ANON:%.*]], align 1
1803 // CHECK11-NEXT: store i32 0, ptr [[RETVAL]], align 4
1804 // CHECK11-NEXT: call void @"_ZZ4mainENK3$_0clEv"(ptr noundef nonnull align 1 dereferenceable(1) [[REF_TMP]])
1805 // CHECK11-NEXT: ret i32 0