[TySan] Don't report globals with incomplete types. (#121922)
[llvm-project.git] / clang / test / OpenMP / teams_generic_loop_codegen-1.cpp
blob2a3a80687e4b04ab7f4e845498b7c5dda04234d5
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 // expected-no-diagnostics
3 #ifndef HEADER
4 #define HEADER
5 // Test host codegen.
6 // RUN: %clang_cc1 -DCK1 -verify -Wno-vla -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK1
7 // RUN: %clang_cc1 -DCK1 -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
8 // RUN: %clang_cc1 -DCK1 -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK1
9 // RUN: %clang_cc1 -DCK1 -verify -Wno-vla -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK3
10 // RUN: %clang_cc1 -DCK1 -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -o %t %s
11 // RUN: %clang_cc1 -DCK1 -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK3
13 // RUN: %clang_cc1 -DCK1 -verify -Wno-vla -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
14 // RUN: %clang_cc1 -DCK1 -fopenmp-simd -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
15 // RUN: %clang_cc1 -DCK1 -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
16 // RUN: %clang_cc1 -DCK1 -verify -Wno-vla -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
17 // RUN: %clang_cc1 -DCK1 -fopenmp-simd -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -o %t %s
18 // RUN: %clang_cc1 -DCK1 -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
19 #ifdef CK1
21 int a[100];
23 int teams_argument_global(int n){
24 int te = n / 128;
25 int th = 128;
26 // discard n_addr
28 #pragma omp target
29 #pragma omp teams loop num_teams(te), thread_limit(th)
30 for(int i = 0; i < n; i++) {
31 a[i] = 0;
34 #pragma omp target
35 {{{
36 #pragma omp teams loop
37 for(int i = 0; i < n; i++) {
38 a[i] = 0;
40 }}}
42 // outlined target regions
47 return a[0];
50 #endif // CK1
52 // Test host codegen.
53 // RUN: %clang_cc1 -DCK2 -verify -Wno-vla -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK9
54 // RUN: %clang_cc1 -DCK2 -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
55 // RUN: %clang_cc1 -DCK2 -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK9
56 // RUN: %clang_cc1 -DCK2 -verify -Wno-vla -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK11
57 // RUN: %clang_cc1 -DCK2 -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -o %t %s
58 // RUN: %clang_cc1 -DCK2 -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK11
60 // RUN: %clang_cc1 -DCK2 -verify -Wno-vla -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
61 // RUN: %clang_cc1 -DCK2 -fopenmp-simd -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
62 // RUN: %clang_cc1 -DCK2 -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
63 // RUN: %clang_cc1 -DCK2 -verify -Wno-vla -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
64 // RUN: %clang_cc1 -DCK2 -fopenmp-simd -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -o %t %s
65 // RUN: %clang_cc1 -DCK2 -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
66 #ifdef CK2
68 int teams_local_arg(void) {
69 int n = 100;
70 int a[n];
72 #pragma omp target
73 #pragma omp teams loop
74 for(int i = 0; i < n; i++) {
75 a[i] = 0;
78 // outlined target region
81 return a[0];
83 #endif // CK2
85 // Test host codegen.
86 // RUN: %clang_cc1 -DCK3 -verify -Wno-vla -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK17
87 // RUN: %clang_cc1 -DCK3 -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
88 // RUN: %clang_cc1 -DCK3 -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK17
89 // RUN: %clang_cc1 -DCK3 -verify -Wno-vla -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK19
90 // RUN: %clang_cc1 -DCK3 -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -o %t %s
91 // RUN: %clang_cc1 -DCK3 -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK19
93 // RUN: %clang_cc1 -DCK3 -verify -Wno-vla -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
94 // RUN: %clang_cc1 -DCK3 -fopenmp-simd -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
95 // RUN: %clang_cc1 -DCK3 -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
96 // RUN: %clang_cc1 -DCK3 -verify -Wno-vla -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
97 // RUN: %clang_cc1 -DCK3 -fopenmp-simd -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -o %t %s
98 // RUN: %clang_cc1 -DCK3 -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
99 #ifdef CK3
102 template <typename T, int X, long long Y>
103 struct SS{
104 T a[X];
105 float b;
106 int foo(void) {
108 #pragma omp target
109 #pragma omp teams loop
110 for(int i = 0; i < X; i++) {
111 a[i] = (T)0;
114 // outlined target region
117 return a[0];
121 int teams_template_struct(void) {
122 SS<int, 123, 456> V;
123 return V.foo();
126 #endif // CK3
128 // Test host codegen.
129 // RUN: %clang_cc1 -DCK4 -verify -Wno-vla -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK25
130 // RUN: %clang_cc1 -DCK4 -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
131 // RUN: %clang_cc1 -DCK4 -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK25
132 // RUN: %clang_cc1 -DCK4 -verify -Wno-vla -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK27
133 // RUN: %clang_cc1 -DCK4 -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -o %t %s
134 // RUN: %clang_cc1 -DCK4 -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK27
136 // RUN: %clang_cc1 -DCK4 -verify -Wno-vla -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
137 // RUN: %clang_cc1 -DCK4 -fopenmp-simd -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
138 // RUN: %clang_cc1 -DCK4 -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
139 // RUN: %clang_cc1 -DCK4 -verify -Wno-vla -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
140 // RUN: %clang_cc1 -DCK4 -fopenmp-simd -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -o %t %s
141 // RUN: %clang_cc1 -DCK4 -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
143 #ifdef CK4
145 template <typename T, int n>
146 int tmain(T argc) {
147 T a[n];
148 int te = n/128;
149 int th = 128;
150 #pragma omp target
151 #pragma omp teams loop num_teams(te) thread_limit(th)
152 for(int i = 0; i < n; i++) {
153 a[i] = (T)0;
155 return 0;
158 int main (int argc, char **argv) {
159 int n = 100;
160 int a[n];
161 #pragma omp target
162 #pragma omp teams loop
163 for(int i = 0; i < n; i++) {
164 a[i] = 0;
166 return tmain<int, 10>(argc);
175 #endif // CK4
176 #endif
177 // CHECK1-LABEL: define {{[^@]+}}@_Z21teams_argument_globali
178 // CHECK1-SAME: (i32 noundef signext [[N:%.*]]) #[[ATTR0:[0-9]+]] {
179 // CHECK1-NEXT: entry:
180 // CHECK1-NEXT: [[N_ADDR:%.*]] = alloca i32, align 4
181 // CHECK1-NEXT: [[TE:%.*]] = alloca i32, align 4
182 // CHECK1-NEXT: [[TH:%.*]] = alloca i32, align 4
183 // CHECK1-NEXT: [[TE_CASTED:%.*]] = alloca i64, align 8
184 // CHECK1-NEXT: [[TH_CASTED:%.*]] = alloca i64, align 8
185 // CHECK1-NEXT: [[N_CASTED:%.*]] = alloca i64, align 8
186 // CHECK1-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [4 x ptr], align 8
187 // CHECK1-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [4 x ptr], align 8
188 // CHECK1-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [4 x ptr], align 8
189 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
190 // CHECK1-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
191 // CHECK1-NEXT: [[DOTCAPTURE_EXPR_1:%.*]] = alloca i32, align 4
192 // CHECK1-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
193 // CHECK1-NEXT: [[N_CASTED4:%.*]] = alloca i64, align 8
194 // CHECK1-NEXT: [[DOTOFFLOAD_BASEPTRS5:%.*]] = alloca [2 x ptr], align 8
195 // CHECK1-NEXT: [[DOTOFFLOAD_PTRS6:%.*]] = alloca [2 x ptr], align 8
196 // CHECK1-NEXT: [[DOTOFFLOAD_MAPPERS7:%.*]] = alloca [2 x ptr], align 8
197 // CHECK1-NEXT: [[_TMP8:%.*]] = alloca i32, align 4
198 // CHECK1-NEXT: [[DOTCAPTURE_EXPR_9:%.*]] = alloca i32, align 4
199 // CHECK1-NEXT: [[DOTCAPTURE_EXPR_10:%.*]] = alloca i32, align 4
200 // CHECK1-NEXT: [[KERNEL_ARGS15:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS]], align 8
201 // CHECK1-NEXT: store i32 [[N]], ptr [[N_ADDR]], align 4
202 // CHECK1-NEXT: [[TMP0:%.*]] = load i32, ptr [[N_ADDR]], align 4
203 // CHECK1-NEXT: [[DIV:%.*]] = sdiv i32 [[TMP0]], 128
204 // CHECK1-NEXT: store i32 [[DIV]], ptr [[TE]], align 4
205 // CHECK1-NEXT: store i32 128, ptr [[TH]], align 4
206 // CHECK1-NEXT: [[TMP1:%.*]] = load i32, ptr [[TE]], align 4
207 // CHECK1-NEXT: store i32 [[TMP1]], ptr [[TE_CASTED]], align 4
208 // CHECK1-NEXT: [[TMP2:%.*]] = load i64, ptr [[TE_CASTED]], align 8
209 // CHECK1-NEXT: [[TMP3:%.*]] = load i32, ptr [[TH]], align 4
210 // CHECK1-NEXT: store i32 [[TMP3]], ptr [[TH_CASTED]], align 4
211 // CHECK1-NEXT: [[TMP4:%.*]] = load i64, ptr [[TH_CASTED]], align 8
212 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[N_ADDR]], align 4
213 // CHECK1-NEXT: store i32 [[TMP5]], ptr [[N_CASTED]], align 4
214 // CHECK1-NEXT: [[TMP6:%.*]] = load i64, ptr [[N_CASTED]], align 8
215 // CHECK1-NEXT: [[TMP7:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
216 // CHECK1-NEXT: store i64 [[TMP2]], ptr [[TMP7]], align 8
217 // CHECK1-NEXT: [[TMP8:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
218 // CHECK1-NEXT: store i64 [[TMP2]], ptr [[TMP8]], align 8
219 // CHECK1-NEXT: [[TMP9:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 0
220 // CHECK1-NEXT: store ptr null, ptr [[TMP9]], align 8
221 // CHECK1-NEXT: [[TMP10:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 1
222 // CHECK1-NEXT: store i64 [[TMP4]], ptr [[TMP10]], align 8
223 // CHECK1-NEXT: [[TMP11:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 1
224 // CHECK1-NEXT: store i64 [[TMP4]], ptr [[TMP11]], align 8
225 // CHECK1-NEXT: [[TMP12:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 1
226 // CHECK1-NEXT: store ptr null, ptr [[TMP12]], align 8
227 // CHECK1-NEXT: [[TMP13:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 2
228 // CHECK1-NEXT: store i64 [[TMP6]], ptr [[TMP13]], align 8
229 // CHECK1-NEXT: [[TMP14:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 2
230 // CHECK1-NEXT: store i64 [[TMP6]], ptr [[TMP14]], align 8
231 // CHECK1-NEXT: [[TMP15:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 2
232 // CHECK1-NEXT: store ptr null, ptr [[TMP15]], align 8
233 // CHECK1-NEXT: [[TMP16:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 3
234 // CHECK1-NEXT: store ptr @a, ptr [[TMP16]], align 8
235 // CHECK1-NEXT: [[TMP17:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 3
236 // CHECK1-NEXT: store ptr @a, ptr [[TMP17]], align 8
237 // CHECK1-NEXT: [[TMP18:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 3
238 // CHECK1-NEXT: store ptr null, ptr [[TMP18]], align 8
239 // CHECK1-NEXT: [[TMP19:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
240 // CHECK1-NEXT: [[TMP20:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
241 // CHECK1-NEXT: [[TMP21:%.*]] = load i32, ptr [[TE]], align 4
242 // CHECK1-NEXT: [[TMP22:%.*]] = load i32, ptr [[TH]], align 4
243 // CHECK1-NEXT: [[TMP23:%.*]] = load i32, ptr [[N_ADDR]], align 4
244 // CHECK1-NEXT: store i32 [[TMP23]], ptr [[DOTCAPTURE_EXPR_]], align 4
245 // CHECK1-NEXT: [[TMP24:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
246 // CHECK1-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP24]], 0
247 // CHECK1-NEXT: [[DIV2:%.*]] = sdiv i32 [[SUB]], 1
248 // CHECK1-NEXT: [[SUB3:%.*]] = sub nsw i32 [[DIV2]], 1
249 // CHECK1-NEXT: store i32 [[SUB3]], ptr [[DOTCAPTURE_EXPR_1]], align 4
250 // CHECK1-NEXT: [[TMP25:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
251 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP25]], 1
252 // CHECK1-NEXT: [[TMP26:%.*]] = zext i32 [[ADD]] to i64
253 // CHECK1-NEXT: [[TMP27:%.*]] = insertvalue [3 x i32] zeroinitializer, i32 [[TMP21]], 0
254 // CHECK1-NEXT: [[TMP28:%.*]] = insertvalue [3 x i32] zeroinitializer, i32 [[TMP22]], 0
255 // CHECK1-NEXT: [[TMP29:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
256 // CHECK1-NEXT: store i32 3, ptr [[TMP29]], align 4
257 // CHECK1-NEXT: [[TMP30:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
258 // CHECK1-NEXT: store i32 4, ptr [[TMP30]], align 4
259 // CHECK1-NEXT: [[TMP31:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
260 // CHECK1-NEXT: store ptr [[TMP19]], ptr [[TMP31]], align 8
261 // CHECK1-NEXT: [[TMP32:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
262 // CHECK1-NEXT: store ptr [[TMP20]], ptr [[TMP32]], align 8
263 // CHECK1-NEXT: [[TMP33:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
264 // CHECK1-NEXT: store ptr @.offload_sizes, ptr [[TMP33]], align 8
265 // CHECK1-NEXT: [[TMP34:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
266 // CHECK1-NEXT: store ptr @.offload_maptypes, ptr [[TMP34]], align 8
267 // CHECK1-NEXT: [[TMP35:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
268 // CHECK1-NEXT: store ptr null, ptr [[TMP35]], align 8
269 // CHECK1-NEXT: [[TMP36:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
270 // CHECK1-NEXT: store ptr null, ptr [[TMP36]], align 8
271 // CHECK1-NEXT: [[TMP37:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
272 // CHECK1-NEXT: store i64 [[TMP26]], ptr [[TMP37]], align 8
273 // CHECK1-NEXT: [[TMP38:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
274 // CHECK1-NEXT: store i64 0, ptr [[TMP38]], align 8
275 // CHECK1-NEXT: [[TMP39:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
276 // CHECK1-NEXT: store [3 x i32] [[TMP27]], ptr [[TMP39]], align 4
277 // CHECK1-NEXT: [[TMP40:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
278 // CHECK1-NEXT: store [3 x i32] [[TMP28]], ptr [[TMP40]], align 4
279 // CHECK1-NEXT: [[TMP41:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
280 // CHECK1-NEXT: store i32 0, ptr [[TMP41]], align 4
281 // CHECK1-NEXT: [[TMP42:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB2:[0-9]+]], i64 -1, i32 [[TMP21]], i32 [[TMP22]], ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z21teams_argument_globali_l28.region_id, ptr [[KERNEL_ARGS]])
282 // CHECK1-NEXT: [[TMP43:%.*]] = icmp ne i32 [[TMP42]], 0
283 // CHECK1-NEXT: br i1 [[TMP43]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
284 // CHECK1: omp_offload.failed:
285 // CHECK1-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z21teams_argument_globali_l28(i64 [[TMP2]], i64 [[TMP4]], i64 [[TMP6]], ptr @a) #[[ATTR2:[0-9]+]]
286 // CHECK1-NEXT: br label [[OMP_OFFLOAD_CONT]]
287 // CHECK1: omp_offload.cont:
288 // CHECK1-NEXT: [[TMP44:%.*]] = load i32, ptr [[N_ADDR]], align 4
289 // CHECK1-NEXT: store i32 [[TMP44]], ptr [[N_CASTED4]], align 4
290 // CHECK1-NEXT: [[TMP45:%.*]] = load i64, ptr [[N_CASTED4]], align 8
291 // CHECK1-NEXT: [[TMP46:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_BASEPTRS5]], i32 0, i32 0
292 // CHECK1-NEXT: store i64 [[TMP45]], ptr [[TMP46]], align 8
293 // CHECK1-NEXT: [[TMP47:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_PTRS6]], i32 0, i32 0
294 // CHECK1-NEXT: store i64 [[TMP45]], ptr [[TMP47]], align 8
295 // CHECK1-NEXT: [[TMP48:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_MAPPERS7]], i64 0, i64 0
296 // CHECK1-NEXT: store ptr null, ptr [[TMP48]], align 8
297 // CHECK1-NEXT: [[TMP49:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_BASEPTRS5]], i32 0, i32 1
298 // CHECK1-NEXT: store ptr @a, ptr [[TMP49]], align 8
299 // CHECK1-NEXT: [[TMP50:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_PTRS6]], i32 0, i32 1
300 // CHECK1-NEXT: store ptr @a, ptr [[TMP50]], align 8
301 // CHECK1-NEXT: [[TMP51:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_MAPPERS7]], i64 0, i64 1
302 // CHECK1-NEXT: store ptr null, ptr [[TMP51]], align 8
303 // CHECK1-NEXT: [[TMP52:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_BASEPTRS5]], i32 0, i32 0
304 // CHECK1-NEXT: [[TMP53:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_PTRS6]], i32 0, i32 0
305 // CHECK1-NEXT: [[TMP54:%.*]] = load i32, ptr [[N_ADDR]], align 4
306 // CHECK1-NEXT: store i32 [[TMP54]], ptr [[DOTCAPTURE_EXPR_9]], align 4
307 // CHECK1-NEXT: [[TMP55:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_9]], align 4
308 // CHECK1-NEXT: [[SUB11:%.*]] = sub nsw i32 [[TMP55]], 0
309 // CHECK1-NEXT: [[DIV12:%.*]] = sdiv i32 [[SUB11]], 1
310 // CHECK1-NEXT: [[SUB13:%.*]] = sub nsw i32 [[DIV12]], 1
311 // CHECK1-NEXT: store i32 [[SUB13]], ptr [[DOTCAPTURE_EXPR_10]], align 4
312 // CHECK1-NEXT: [[TMP56:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_10]], align 4
313 // CHECK1-NEXT: [[ADD14:%.*]] = add nsw i32 [[TMP56]], 1
314 // CHECK1-NEXT: [[TMP57:%.*]] = zext i32 [[ADD14]] to i64
315 // CHECK1-NEXT: [[TMP58:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 0
316 // CHECK1-NEXT: store i32 3, ptr [[TMP58]], align 4
317 // CHECK1-NEXT: [[TMP59:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 1
318 // CHECK1-NEXT: store i32 2, ptr [[TMP59]], align 4
319 // CHECK1-NEXT: [[TMP60:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 2
320 // CHECK1-NEXT: store ptr [[TMP52]], ptr [[TMP60]], align 8
321 // CHECK1-NEXT: [[TMP61:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 3
322 // CHECK1-NEXT: store ptr [[TMP53]], ptr [[TMP61]], align 8
323 // CHECK1-NEXT: [[TMP62:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 4
324 // CHECK1-NEXT: store ptr @.offload_sizes.1, ptr [[TMP62]], align 8
325 // CHECK1-NEXT: [[TMP63:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 5
326 // CHECK1-NEXT: store ptr @.offload_maptypes.2, ptr [[TMP63]], align 8
327 // CHECK1-NEXT: [[TMP64:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 6
328 // CHECK1-NEXT: store ptr null, ptr [[TMP64]], align 8
329 // CHECK1-NEXT: [[TMP65:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 7
330 // CHECK1-NEXT: store ptr null, ptr [[TMP65]], align 8
331 // CHECK1-NEXT: [[TMP66:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 8
332 // CHECK1-NEXT: store i64 [[TMP57]], ptr [[TMP66]], align 8
333 // CHECK1-NEXT: [[TMP67:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 9
334 // CHECK1-NEXT: store i64 0, ptr [[TMP67]], align 8
335 // CHECK1-NEXT: [[TMP68:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 10
336 // CHECK1-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP68]], align 4
337 // CHECK1-NEXT: [[TMP69:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 11
338 // CHECK1-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP69]], align 4
339 // CHECK1-NEXT: [[TMP70:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 12
340 // CHECK1-NEXT: store i32 0, ptr [[TMP70]], align 4
341 // CHECK1-NEXT: [[TMP71:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB2]], i64 -1, i32 0, i32 0, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z21teams_argument_globali_l34.region_id, ptr [[KERNEL_ARGS15]])
342 // CHECK1-NEXT: [[TMP72:%.*]] = icmp ne i32 [[TMP71]], 0
343 // CHECK1-NEXT: br i1 [[TMP72]], label [[OMP_OFFLOAD_FAILED16:%.*]], label [[OMP_OFFLOAD_CONT17:%.*]]
344 // CHECK1: omp_offload.failed16:
345 // CHECK1-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z21teams_argument_globali_l34(i64 [[TMP45]], ptr @a) #[[ATTR2]]
346 // CHECK1-NEXT: br label [[OMP_OFFLOAD_CONT17]]
347 // CHECK1: omp_offload.cont17:
348 // CHECK1-NEXT: [[TMP73:%.*]] = load i32, ptr @a, align 4
349 // CHECK1-NEXT: ret i32 [[TMP73]]
352 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z21teams_argument_globali_l28
353 // CHECK1-SAME: (i64 noundef [[TE:%.*]], i64 noundef [[TH:%.*]], i64 noundef [[N:%.*]], ptr noundef nonnull align 4 dereferenceable(400) [[A:%.*]]) #[[ATTR1:[0-9]+]] {
354 // CHECK1-NEXT: entry:
355 // CHECK1-NEXT: [[TE_ADDR:%.*]] = alloca i64, align 8
356 // CHECK1-NEXT: [[TH_ADDR:%.*]] = alloca i64, align 8
357 // CHECK1-NEXT: [[N_ADDR:%.*]] = alloca i64, align 8
358 // CHECK1-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
359 // CHECK1-NEXT: [[TMP0:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB2]])
360 // CHECK1-NEXT: store i64 [[TE]], ptr [[TE_ADDR]], align 8
361 // CHECK1-NEXT: store i64 [[TH]], ptr [[TH_ADDR]], align 8
362 // CHECK1-NEXT: store i64 [[N]], ptr [[N_ADDR]], align 8
363 // CHECK1-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8
364 // CHECK1-NEXT: [[TMP1:%.*]] = load ptr, ptr [[A_ADDR]], align 8
365 // CHECK1-NEXT: [[TMP2:%.*]] = load i32, ptr [[TE_ADDR]], align 4
366 // CHECK1-NEXT: [[TMP3:%.*]] = load i32, ptr [[TH_ADDR]], align 4
367 // CHECK1-NEXT: call void @__kmpc_push_num_teams(ptr @[[GLOB2]], i32 [[TMP0]], i32 [[TMP2]], i32 [[TMP3]])
368 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB2]], i32 2, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z21teams_argument_globali_l28.omp_outlined, ptr [[N_ADDR]], ptr [[TMP1]])
369 // CHECK1-NEXT: ret void
372 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z21teams_argument_globali_l28.omp_outlined
373 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[N:%.*]], ptr noundef nonnull align 4 dereferenceable(400) [[A:%.*]]) #[[ATTR1]] {
374 // CHECK1-NEXT: entry:
375 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
376 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
377 // CHECK1-NEXT: [[N_ADDR:%.*]] = alloca ptr, align 8
378 // CHECK1-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
379 // CHECK1-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
380 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
381 // CHECK1-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
382 // CHECK1-NEXT: [[DOTCAPTURE_EXPR_1:%.*]] = alloca i32, align 4
383 // CHECK1-NEXT: [[I:%.*]] = alloca i32, align 4
384 // CHECK1-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
385 // CHECK1-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
386 // CHECK1-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
387 // CHECK1-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
388 // CHECK1-NEXT: [[I3:%.*]] = alloca i32, align 4
389 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
390 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
391 // CHECK1-NEXT: store ptr [[N]], ptr [[N_ADDR]], align 8
392 // CHECK1-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8
393 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[N_ADDR]], align 8
394 // CHECK1-NEXT: [[TMP1:%.*]] = load ptr, ptr [[A_ADDR]], align 8
395 // CHECK1-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP0]], align 4
396 // CHECK1-NEXT: store i32 [[TMP2]], ptr [[DOTCAPTURE_EXPR_]], align 4
397 // CHECK1-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
398 // CHECK1-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP3]], 0
399 // CHECK1-NEXT: [[DIV:%.*]] = sdiv i32 [[SUB]], 1
400 // CHECK1-NEXT: [[SUB2:%.*]] = sub nsw i32 [[DIV]], 1
401 // CHECK1-NEXT: store i32 [[SUB2]], ptr [[DOTCAPTURE_EXPR_1]], align 4
402 // CHECK1-NEXT: store i32 0, ptr [[I]], align 4
403 // CHECK1-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
404 // CHECK1-NEXT: [[CMP:%.*]] = icmp slt i32 0, [[TMP4]]
405 // CHECK1-NEXT: br i1 [[CMP]], label [[OMP_PRECOND_THEN:%.*]], label [[OMP_PRECOND_END:%.*]]
406 // CHECK1: omp.precond.then:
407 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
408 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
409 // CHECK1-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_COMB_UB]], align 4
410 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
411 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
412 // CHECK1-NEXT: [[TMP6:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
413 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[TMP6]], align 4
414 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1:[0-9]+]], i32 [[TMP7]], i32 92, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_COMB_LB]], ptr [[DOTOMP_COMB_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
415 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
416 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
417 // CHECK1-NEXT: [[CMP4:%.*]] = icmp sgt i32 [[TMP8]], [[TMP9]]
418 // CHECK1-NEXT: br i1 [[CMP4]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
419 // CHECK1: cond.true:
420 // CHECK1-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
421 // CHECK1-NEXT: br label [[COND_END:%.*]]
422 // CHECK1: cond.false:
423 // CHECK1-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
424 // CHECK1-NEXT: br label [[COND_END]]
425 // CHECK1: cond.end:
426 // CHECK1-NEXT: [[COND:%.*]] = phi i32 [ [[TMP10]], [[COND_TRUE]] ], [ [[TMP11]], [[COND_FALSE]] ]
427 // CHECK1-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
428 // CHECK1-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
429 // CHECK1-NEXT: store i32 [[TMP12]], ptr [[DOTOMP_IV]], align 4
430 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
431 // CHECK1: omp.inner.for.cond:
432 // CHECK1-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
433 // CHECK1-NEXT: [[TMP14:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
434 // CHECK1-NEXT: [[CMP5:%.*]] = icmp sle i32 [[TMP13]], [[TMP14]]
435 // CHECK1-NEXT: br i1 [[CMP5]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
436 // CHECK1: omp.inner.for.body:
437 // CHECK1-NEXT: [[TMP15:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
438 // CHECK1-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP15]], 1
439 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
440 // CHECK1-NEXT: store i32 [[ADD]], ptr [[I3]], align 4
441 // CHECK1-NEXT: [[TMP16:%.*]] = load i32, ptr [[I3]], align 4
442 // CHECK1-NEXT: [[IDXPROM:%.*]] = sext i32 [[TMP16]] to i64
443 // CHECK1-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [100 x i32], ptr [[TMP1]], i64 0, i64 [[IDXPROM]]
444 // CHECK1-NEXT: store i32 0, ptr [[ARRAYIDX]], align 4
445 // CHECK1-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
446 // CHECK1: omp.body.continue:
447 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
448 // CHECK1: omp.inner.for.inc:
449 // CHECK1-NEXT: [[TMP17:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
450 // CHECK1-NEXT: [[ADD6:%.*]] = add nsw i32 [[TMP17]], 1
451 // CHECK1-NEXT: store i32 [[ADD6]], ptr [[DOTOMP_IV]], align 4
452 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]]
453 // CHECK1: omp.inner.for.end:
454 // CHECK1-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
455 // CHECK1: omp.loop.exit:
456 // CHECK1-NEXT: [[TMP18:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
457 // CHECK1-NEXT: [[TMP19:%.*]] = load i32, ptr [[TMP18]], align 4
458 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP19]])
459 // CHECK1-NEXT: br label [[OMP_PRECOND_END]]
460 // CHECK1: omp.precond.end:
461 // CHECK1-NEXT: ret void
464 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z21teams_argument_globali_l34
465 // CHECK1-SAME: (i64 noundef [[N:%.*]], ptr noundef nonnull align 4 dereferenceable(400) [[A:%.*]]) #[[ATTR1]] {
466 // CHECK1-NEXT: entry:
467 // CHECK1-NEXT: [[N_ADDR:%.*]] = alloca i64, align 8
468 // CHECK1-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
469 // CHECK1-NEXT: store i64 [[N]], ptr [[N_ADDR]], align 8
470 // CHECK1-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8
471 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[A_ADDR]], align 8
472 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB2]], i32 2, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z21teams_argument_globali_l34.omp_outlined, ptr [[N_ADDR]], ptr [[TMP0]])
473 // CHECK1-NEXT: ret void
476 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z21teams_argument_globali_l34.omp_outlined
477 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[N:%.*]], ptr noundef nonnull align 4 dereferenceable(400) [[A:%.*]]) #[[ATTR1]] {
478 // CHECK1-NEXT: entry:
479 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
480 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
481 // CHECK1-NEXT: [[N_ADDR:%.*]] = alloca ptr, align 8
482 // CHECK1-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
483 // CHECK1-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
484 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
485 // CHECK1-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
486 // CHECK1-NEXT: [[DOTCAPTURE_EXPR_1:%.*]] = alloca i32, align 4
487 // CHECK1-NEXT: [[I:%.*]] = alloca i32, align 4
488 // CHECK1-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
489 // CHECK1-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
490 // CHECK1-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
491 // CHECK1-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
492 // CHECK1-NEXT: [[I3:%.*]] = alloca i32, align 4
493 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
494 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
495 // CHECK1-NEXT: store ptr [[N]], ptr [[N_ADDR]], align 8
496 // CHECK1-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8
497 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[N_ADDR]], align 8
498 // CHECK1-NEXT: [[TMP1:%.*]] = load ptr, ptr [[A_ADDR]], align 8
499 // CHECK1-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP0]], align 4
500 // CHECK1-NEXT: store i32 [[TMP2]], ptr [[DOTCAPTURE_EXPR_]], align 4
501 // CHECK1-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
502 // CHECK1-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP3]], 0
503 // CHECK1-NEXT: [[DIV:%.*]] = sdiv i32 [[SUB]], 1
504 // CHECK1-NEXT: [[SUB2:%.*]] = sub nsw i32 [[DIV]], 1
505 // CHECK1-NEXT: store i32 [[SUB2]], ptr [[DOTCAPTURE_EXPR_1]], align 4
506 // CHECK1-NEXT: store i32 0, ptr [[I]], align 4
507 // CHECK1-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
508 // CHECK1-NEXT: [[CMP:%.*]] = icmp slt i32 0, [[TMP4]]
509 // CHECK1-NEXT: br i1 [[CMP]], label [[OMP_PRECOND_THEN:%.*]], label [[OMP_PRECOND_END:%.*]]
510 // CHECK1: omp.precond.then:
511 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
512 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
513 // CHECK1-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_COMB_UB]], align 4
514 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
515 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
516 // CHECK1-NEXT: [[TMP6:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
517 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[TMP6]], align 4
518 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1]], i32 [[TMP7]], i32 92, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_COMB_LB]], ptr [[DOTOMP_COMB_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
519 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
520 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
521 // CHECK1-NEXT: [[CMP4:%.*]] = icmp sgt i32 [[TMP8]], [[TMP9]]
522 // CHECK1-NEXT: br i1 [[CMP4]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
523 // CHECK1: cond.true:
524 // CHECK1-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
525 // CHECK1-NEXT: br label [[COND_END:%.*]]
526 // CHECK1: cond.false:
527 // CHECK1-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
528 // CHECK1-NEXT: br label [[COND_END]]
529 // CHECK1: cond.end:
530 // CHECK1-NEXT: [[COND:%.*]] = phi i32 [ [[TMP10]], [[COND_TRUE]] ], [ [[TMP11]], [[COND_FALSE]] ]
531 // CHECK1-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
532 // CHECK1-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
533 // CHECK1-NEXT: store i32 [[TMP12]], ptr [[DOTOMP_IV]], align 4
534 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
535 // CHECK1: omp.inner.for.cond:
536 // CHECK1-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
537 // CHECK1-NEXT: [[TMP14:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
538 // CHECK1-NEXT: [[CMP5:%.*]] = icmp sle i32 [[TMP13]], [[TMP14]]
539 // CHECK1-NEXT: br i1 [[CMP5]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
540 // CHECK1: omp.inner.for.body:
541 // CHECK1-NEXT: [[TMP15:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
542 // CHECK1-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP15]], 1
543 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
544 // CHECK1-NEXT: store i32 [[ADD]], ptr [[I3]], align 4
545 // CHECK1-NEXT: [[TMP16:%.*]] = load i32, ptr [[I3]], align 4
546 // CHECK1-NEXT: [[IDXPROM:%.*]] = sext i32 [[TMP16]] to i64
547 // CHECK1-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [100 x i32], ptr [[TMP1]], i64 0, i64 [[IDXPROM]]
548 // CHECK1-NEXT: store i32 0, ptr [[ARRAYIDX]], align 4
549 // CHECK1-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
550 // CHECK1: omp.body.continue:
551 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
552 // CHECK1: omp.inner.for.inc:
553 // CHECK1-NEXT: [[TMP17:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
554 // CHECK1-NEXT: [[ADD6:%.*]] = add nsw i32 [[TMP17]], 1
555 // CHECK1-NEXT: store i32 [[ADD6]], ptr [[DOTOMP_IV]], align 4
556 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]]
557 // CHECK1: omp.inner.for.end:
558 // CHECK1-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
559 // CHECK1: omp.loop.exit:
560 // CHECK1-NEXT: [[TMP18:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
561 // CHECK1-NEXT: [[TMP19:%.*]] = load i32, ptr [[TMP18]], align 4
562 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP19]])
563 // CHECK1-NEXT: br label [[OMP_PRECOND_END]]
564 // CHECK1: omp.precond.end:
565 // CHECK1-NEXT: ret void
568 // CHECK3-LABEL: define {{[^@]+}}@_Z21teams_argument_globali
569 // CHECK3-SAME: (i32 noundef [[N:%.*]]) #[[ATTR0:[0-9]+]] {
570 // CHECK3-NEXT: entry:
571 // CHECK3-NEXT: [[N_ADDR:%.*]] = alloca i32, align 4
572 // CHECK3-NEXT: [[TE:%.*]] = alloca i32, align 4
573 // CHECK3-NEXT: [[TH:%.*]] = alloca i32, align 4
574 // CHECK3-NEXT: [[TE_CASTED:%.*]] = alloca i32, align 4
575 // CHECK3-NEXT: [[TH_CASTED:%.*]] = alloca i32, align 4
576 // CHECK3-NEXT: [[N_CASTED:%.*]] = alloca i32, align 4
577 // CHECK3-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [4 x ptr], align 4
578 // CHECK3-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [4 x ptr], align 4
579 // CHECK3-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [4 x ptr], align 4
580 // CHECK3-NEXT: [[TMP:%.*]] = alloca i32, align 4
581 // CHECK3-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
582 // CHECK3-NEXT: [[DOTCAPTURE_EXPR_1:%.*]] = alloca i32, align 4
583 // CHECK3-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
584 // CHECK3-NEXT: [[N_CASTED4:%.*]] = alloca i32, align 4
585 // CHECK3-NEXT: [[DOTOFFLOAD_BASEPTRS5:%.*]] = alloca [2 x ptr], align 4
586 // CHECK3-NEXT: [[DOTOFFLOAD_PTRS6:%.*]] = alloca [2 x ptr], align 4
587 // CHECK3-NEXT: [[DOTOFFLOAD_MAPPERS7:%.*]] = alloca [2 x ptr], align 4
588 // CHECK3-NEXT: [[_TMP8:%.*]] = alloca i32, align 4
589 // CHECK3-NEXT: [[DOTCAPTURE_EXPR_9:%.*]] = alloca i32, align 4
590 // CHECK3-NEXT: [[DOTCAPTURE_EXPR_10:%.*]] = alloca i32, align 4
591 // CHECK3-NEXT: [[KERNEL_ARGS15:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS]], align 8
592 // CHECK3-NEXT: store i32 [[N]], ptr [[N_ADDR]], align 4
593 // CHECK3-NEXT: [[TMP0:%.*]] = load i32, ptr [[N_ADDR]], align 4
594 // CHECK3-NEXT: [[DIV:%.*]] = sdiv i32 [[TMP0]], 128
595 // CHECK3-NEXT: store i32 [[DIV]], ptr [[TE]], align 4
596 // CHECK3-NEXT: store i32 128, ptr [[TH]], align 4
597 // CHECK3-NEXT: [[TMP1:%.*]] = load i32, ptr [[TE]], align 4
598 // CHECK3-NEXT: store i32 [[TMP1]], ptr [[TE_CASTED]], align 4
599 // CHECK3-NEXT: [[TMP2:%.*]] = load i32, ptr [[TE_CASTED]], align 4
600 // CHECK3-NEXT: [[TMP3:%.*]] = load i32, ptr [[TH]], align 4
601 // CHECK3-NEXT: store i32 [[TMP3]], ptr [[TH_CASTED]], align 4
602 // CHECK3-NEXT: [[TMP4:%.*]] = load i32, ptr [[TH_CASTED]], align 4
603 // CHECK3-NEXT: [[TMP5:%.*]] = load i32, ptr [[N_ADDR]], align 4
604 // CHECK3-NEXT: store i32 [[TMP5]], ptr [[N_CASTED]], align 4
605 // CHECK3-NEXT: [[TMP6:%.*]] = load i32, ptr [[N_CASTED]], align 4
606 // CHECK3-NEXT: [[TMP7:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
607 // CHECK3-NEXT: store i32 [[TMP2]], ptr [[TMP7]], align 4
608 // CHECK3-NEXT: [[TMP8:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
609 // CHECK3-NEXT: store i32 [[TMP2]], ptr [[TMP8]], align 4
610 // CHECK3-NEXT: [[TMP9:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i32 0, i32 0
611 // CHECK3-NEXT: store ptr null, ptr [[TMP9]], align 4
612 // CHECK3-NEXT: [[TMP10:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 1
613 // CHECK3-NEXT: store i32 [[TMP4]], ptr [[TMP10]], align 4
614 // CHECK3-NEXT: [[TMP11:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 1
615 // CHECK3-NEXT: store i32 [[TMP4]], ptr [[TMP11]], align 4
616 // CHECK3-NEXT: [[TMP12:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i32 0, i32 1
617 // CHECK3-NEXT: store ptr null, ptr [[TMP12]], align 4
618 // CHECK3-NEXT: [[TMP13:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 2
619 // CHECK3-NEXT: store i32 [[TMP6]], ptr [[TMP13]], align 4
620 // CHECK3-NEXT: [[TMP14:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 2
621 // CHECK3-NEXT: store i32 [[TMP6]], ptr [[TMP14]], align 4
622 // CHECK3-NEXT: [[TMP15:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i32 0, i32 2
623 // CHECK3-NEXT: store ptr null, ptr [[TMP15]], align 4
624 // CHECK3-NEXT: [[TMP16:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 3
625 // CHECK3-NEXT: store ptr @a, ptr [[TMP16]], align 4
626 // CHECK3-NEXT: [[TMP17:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 3
627 // CHECK3-NEXT: store ptr @a, ptr [[TMP17]], align 4
628 // CHECK3-NEXT: [[TMP18:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i32 0, i32 3
629 // CHECK3-NEXT: store ptr null, ptr [[TMP18]], align 4
630 // CHECK3-NEXT: [[TMP19:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
631 // CHECK3-NEXT: [[TMP20:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
632 // CHECK3-NEXT: [[TMP21:%.*]] = load i32, ptr [[TE]], align 4
633 // CHECK3-NEXT: [[TMP22:%.*]] = load i32, ptr [[TH]], align 4
634 // CHECK3-NEXT: [[TMP23:%.*]] = load i32, ptr [[N_ADDR]], align 4
635 // CHECK3-NEXT: store i32 [[TMP23]], ptr [[DOTCAPTURE_EXPR_]], align 4
636 // CHECK3-NEXT: [[TMP24:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
637 // CHECK3-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP24]], 0
638 // CHECK3-NEXT: [[DIV2:%.*]] = sdiv i32 [[SUB]], 1
639 // CHECK3-NEXT: [[SUB3:%.*]] = sub nsw i32 [[DIV2]], 1
640 // CHECK3-NEXT: store i32 [[SUB3]], ptr [[DOTCAPTURE_EXPR_1]], align 4
641 // CHECK3-NEXT: [[TMP25:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
642 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP25]], 1
643 // CHECK3-NEXT: [[TMP26:%.*]] = zext i32 [[ADD]] to i64
644 // CHECK3-NEXT: [[TMP27:%.*]] = insertvalue [3 x i32] zeroinitializer, i32 [[TMP21]], 0
645 // CHECK3-NEXT: [[TMP28:%.*]] = insertvalue [3 x i32] zeroinitializer, i32 [[TMP22]], 0
646 // CHECK3-NEXT: [[TMP29:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
647 // CHECK3-NEXT: store i32 3, ptr [[TMP29]], align 4
648 // CHECK3-NEXT: [[TMP30:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
649 // CHECK3-NEXT: store i32 4, ptr [[TMP30]], align 4
650 // CHECK3-NEXT: [[TMP31:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
651 // CHECK3-NEXT: store ptr [[TMP19]], ptr [[TMP31]], align 4
652 // CHECK3-NEXT: [[TMP32:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
653 // CHECK3-NEXT: store ptr [[TMP20]], ptr [[TMP32]], align 4
654 // CHECK3-NEXT: [[TMP33:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
655 // CHECK3-NEXT: store ptr @.offload_sizes, ptr [[TMP33]], align 4
656 // CHECK3-NEXT: [[TMP34:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
657 // CHECK3-NEXT: store ptr @.offload_maptypes, ptr [[TMP34]], align 4
658 // CHECK3-NEXT: [[TMP35:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
659 // CHECK3-NEXT: store ptr null, ptr [[TMP35]], align 4
660 // CHECK3-NEXT: [[TMP36:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
661 // CHECK3-NEXT: store ptr null, ptr [[TMP36]], align 4
662 // CHECK3-NEXT: [[TMP37:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
663 // CHECK3-NEXT: store i64 [[TMP26]], ptr [[TMP37]], align 8
664 // CHECK3-NEXT: [[TMP38:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
665 // CHECK3-NEXT: store i64 0, ptr [[TMP38]], align 8
666 // CHECK3-NEXT: [[TMP39:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
667 // CHECK3-NEXT: store [3 x i32] [[TMP27]], ptr [[TMP39]], align 4
668 // CHECK3-NEXT: [[TMP40:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
669 // CHECK3-NEXT: store [3 x i32] [[TMP28]], ptr [[TMP40]], align 4
670 // CHECK3-NEXT: [[TMP41:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
671 // CHECK3-NEXT: store i32 0, ptr [[TMP41]], align 4
672 // CHECK3-NEXT: [[TMP42:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB2:[0-9]+]], i64 -1, i32 [[TMP21]], i32 [[TMP22]], ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z21teams_argument_globali_l28.region_id, ptr [[KERNEL_ARGS]])
673 // CHECK3-NEXT: [[TMP43:%.*]] = icmp ne i32 [[TMP42]], 0
674 // CHECK3-NEXT: br i1 [[TMP43]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
675 // CHECK3: omp_offload.failed:
676 // CHECK3-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z21teams_argument_globali_l28(i32 [[TMP2]], i32 [[TMP4]], i32 [[TMP6]], ptr @a) #[[ATTR2:[0-9]+]]
677 // CHECK3-NEXT: br label [[OMP_OFFLOAD_CONT]]
678 // CHECK3: omp_offload.cont:
679 // CHECK3-NEXT: [[TMP44:%.*]] = load i32, ptr [[N_ADDR]], align 4
680 // CHECK3-NEXT: store i32 [[TMP44]], ptr [[N_CASTED4]], align 4
681 // CHECK3-NEXT: [[TMP45:%.*]] = load i32, ptr [[N_CASTED4]], align 4
682 // CHECK3-NEXT: [[TMP46:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_BASEPTRS5]], i32 0, i32 0
683 // CHECK3-NEXT: store i32 [[TMP45]], ptr [[TMP46]], align 4
684 // CHECK3-NEXT: [[TMP47:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_PTRS6]], i32 0, i32 0
685 // CHECK3-NEXT: store i32 [[TMP45]], ptr [[TMP47]], align 4
686 // CHECK3-NEXT: [[TMP48:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_MAPPERS7]], i32 0, i32 0
687 // CHECK3-NEXT: store ptr null, ptr [[TMP48]], align 4
688 // CHECK3-NEXT: [[TMP49:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_BASEPTRS5]], i32 0, i32 1
689 // CHECK3-NEXT: store ptr @a, ptr [[TMP49]], align 4
690 // CHECK3-NEXT: [[TMP50:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_PTRS6]], i32 0, i32 1
691 // CHECK3-NEXT: store ptr @a, ptr [[TMP50]], align 4
692 // CHECK3-NEXT: [[TMP51:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_MAPPERS7]], i32 0, i32 1
693 // CHECK3-NEXT: store ptr null, ptr [[TMP51]], align 4
694 // CHECK3-NEXT: [[TMP52:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_BASEPTRS5]], i32 0, i32 0
695 // CHECK3-NEXT: [[TMP53:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_PTRS6]], i32 0, i32 0
696 // CHECK3-NEXT: [[TMP54:%.*]] = load i32, ptr [[N_ADDR]], align 4
697 // CHECK3-NEXT: store i32 [[TMP54]], ptr [[DOTCAPTURE_EXPR_9]], align 4
698 // CHECK3-NEXT: [[TMP55:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_9]], align 4
699 // CHECK3-NEXT: [[SUB11:%.*]] = sub nsw i32 [[TMP55]], 0
700 // CHECK3-NEXT: [[DIV12:%.*]] = sdiv i32 [[SUB11]], 1
701 // CHECK3-NEXT: [[SUB13:%.*]] = sub nsw i32 [[DIV12]], 1
702 // CHECK3-NEXT: store i32 [[SUB13]], ptr [[DOTCAPTURE_EXPR_10]], align 4
703 // CHECK3-NEXT: [[TMP56:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_10]], align 4
704 // CHECK3-NEXT: [[ADD14:%.*]] = add nsw i32 [[TMP56]], 1
705 // CHECK3-NEXT: [[TMP57:%.*]] = zext i32 [[ADD14]] to i64
706 // CHECK3-NEXT: [[TMP58:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 0
707 // CHECK3-NEXT: store i32 3, ptr [[TMP58]], align 4
708 // CHECK3-NEXT: [[TMP59:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 1
709 // CHECK3-NEXT: store i32 2, ptr [[TMP59]], align 4
710 // CHECK3-NEXT: [[TMP60:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 2
711 // CHECK3-NEXT: store ptr [[TMP52]], ptr [[TMP60]], align 4
712 // CHECK3-NEXT: [[TMP61:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 3
713 // CHECK3-NEXT: store ptr [[TMP53]], ptr [[TMP61]], align 4
714 // CHECK3-NEXT: [[TMP62:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 4
715 // CHECK3-NEXT: store ptr @.offload_sizes.1, ptr [[TMP62]], align 4
716 // CHECK3-NEXT: [[TMP63:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 5
717 // CHECK3-NEXT: store ptr @.offload_maptypes.2, ptr [[TMP63]], align 4
718 // CHECK3-NEXT: [[TMP64:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 6
719 // CHECK3-NEXT: store ptr null, ptr [[TMP64]], align 4
720 // CHECK3-NEXT: [[TMP65:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 7
721 // CHECK3-NEXT: store ptr null, ptr [[TMP65]], align 4
722 // CHECK3-NEXT: [[TMP66:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 8
723 // CHECK3-NEXT: store i64 [[TMP57]], ptr [[TMP66]], align 8
724 // CHECK3-NEXT: [[TMP67:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 9
725 // CHECK3-NEXT: store i64 0, ptr [[TMP67]], align 8
726 // CHECK3-NEXT: [[TMP68:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 10
727 // CHECK3-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP68]], align 4
728 // CHECK3-NEXT: [[TMP69:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 11
729 // CHECK3-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP69]], align 4
730 // CHECK3-NEXT: [[TMP70:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 12
731 // CHECK3-NEXT: store i32 0, ptr [[TMP70]], align 4
732 // CHECK3-NEXT: [[TMP71:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB2]], i64 -1, i32 0, i32 0, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z21teams_argument_globali_l34.region_id, ptr [[KERNEL_ARGS15]])
733 // CHECK3-NEXT: [[TMP72:%.*]] = icmp ne i32 [[TMP71]], 0
734 // CHECK3-NEXT: br i1 [[TMP72]], label [[OMP_OFFLOAD_FAILED16:%.*]], label [[OMP_OFFLOAD_CONT17:%.*]]
735 // CHECK3: omp_offload.failed16:
736 // CHECK3-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z21teams_argument_globali_l34(i32 [[TMP45]], ptr @a) #[[ATTR2]]
737 // CHECK3-NEXT: br label [[OMP_OFFLOAD_CONT17]]
738 // CHECK3: omp_offload.cont17:
739 // CHECK3-NEXT: [[TMP73:%.*]] = load i32, ptr @a, align 4
740 // CHECK3-NEXT: ret i32 [[TMP73]]
743 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z21teams_argument_globali_l28
744 // CHECK3-SAME: (i32 noundef [[TE:%.*]], i32 noundef [[TH:%.*]], i32 noundef [[N:%.*]], ptr noundef nonnull align 4 dereferenceable(400) [[A:%.*]]) #[[ATTR1:[0-9]+]] {
745 // CHECK3-NEXT: entry:
746 // CHECK3-NEXT: [[TE_ADDR:%.*]] = alloca i32, align 4
747 // CHECK3-NEXT: [[TH_ADDR:%.*]] = alloca i32, align 4
748 // CHECK3-NEXT: [[N_ADDR:%.*]] = alloca i32, align 4
749 // CHECK3-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 4
750 // CHECK3-NEXT: [[TMP0:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB2]])
751 // CHECK3-NEXT: store i32 [[TE]], ptr [[TE_ADDR]], align 4
752 // CHECK3-NEXT: store i32 [[TH]], ptr [[TH_ADDR]], align 4
753 // CHECK3-NEXT: store i32 [[N]], ptr [[N_ADDR]], align 4
754 // CHECK3-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 4
755 // CHECK3-NEXT: [[TMP1:%.*]] = load ptr, ptr [[A_ADDR]], align 4
756 // CHECK3-NEXT: [[TMP2:%.*]] = load i32, ptr [[TE_ADDR]], align 4
757 // CHECK3-NEXT: [[TMP3:%.*]] = load i32, ptr [[TH_ADDR]], align 4
758 // CHECK3-NEXT: call void @__kmpc_push_num_teams(ptr @[[GLOB2]], i32 [[TMP0]], i32 [[TMP2]], i32 [[TMP3]])
759 // CHECK3-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB2]], i32 2, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z21teams_argument_globali_l28.omp_outlined, ptr [[N_ADDR]], ptr [[TMP1]])
760 // CHECK3-NEXT: ret void
763 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z21teams_argument_globali_l28.omp_outlined
764 // CHECK3-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[N:%.*]], ptr noundef nonnull align 4 dereferenceable(400) [[A:%.*]]) #[[ATTR1]] {
765 // CHECK3-NEXT: entry:
766 // CHECK3-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 4
767 // CHECK3-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 4
768 // CHECK3-NEXT: [[N_ADDR:%.*]] = alloca ptr, align 4
769 // CHECK3-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 4
770 // CHECK3-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
771 // CHECK3-NEXT: [[TMP:%.*]] = alloca i32, align 4
772 // CHECK3-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
773 // CHECK3-NEXT: [[DOTCAPTURE_EXPR_1:%.*]] = alloca i32, align 4
774 // CHECK3-NEXT: [[I:%.*]] = alloca i32, align 4
775 // CHECK3-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
776 // CHECK3-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
777 // CHECK3-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
778 // CHECK3-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
779 // CHECK3-NEXT: [[I3:%.*]] = alloca i32, align 4
780 // CHECK3-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 4
781 // CHECK3-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 4
782 // CHECK3-NEXT: store ptr [[N]], ptr [[N_ADDR]], align 4
783 // CHECK3-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 4
784 // CHECK3-NEXT: [[TMP0:%.*]] = load ptr, ptr [[N_ADDR]], align 4
785 // CHECK3-NEXT: [[TMP1:%.*]] = load ptr, ptr [[A_ADDR]], align 4
786 // CHECK3-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP0]], align 4
787 // CHECK3-NEXT: store i32 [[TMP2]], ptr [[DOTCAPTURE_EXPR_]], align 4
788 // CHECK3-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
789 // CHECK3-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP3]], 0
790 // CHECK3-NEXT: [[DIV:%.*]] = sdiv i32 [[SUB]], 1
791 // CHECK3-NEXT: [[SUB2:%.*]] = sub nsw i32 [[DIV]], 1
792 // CHECK3-NEXT: store i32 [[SUB2]], ptr [[DOTCAPTURE_EXPR_1]], align 4
793 // CHECK3-NEXT: store i32 0, ptr [[I]], align 4
794 // CHECK3-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
795 // CHECK3-NEXT: [[CMP:%.*]] = icmp slt i32 0, [[TMP4]]
796 // CHECK3-NEXT: br i1 [[CMP]], label [[OMP_PRECOND_THEN:%.*]], label [[OMP_PRECOND_END:%.*]]
797 // CHECK3: omp.precond.then:
798 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
799 // CHECK3-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
800 // CHECK3-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_COMB_UB]], align 4
801 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
802 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
803 // CHECK3-NEXT: [[TMP6:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 4
804 // CHECK3-NEXT: [[TMP7:%.*]] = load i32, ptr [[TMP6]], align 4
805 // CHECK3-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1:[0-9]+]], i32 [[TMP7]], i32 92, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_COMB_LB]], ptr [[DOTOMP_COMB_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
806 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
807 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
808 // CHECK3-NEXT: [[CMP4:%.*]] = icmp sgt i32 [[TMP8]], [[TMP9]]
809 // CHECK3-NEXT: br i1 [[CMP4]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
810 // CHECK3: cond.true:
811 // CHECK3-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
812 // CHECK3-NEXT: br label [[COND_END:%.*]]
813 // CHECK3: cond.false:
814 // CHECK3-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
815 // CHECK3-NEXT: br label [[COND_END]]
816 // CHECK3: cond.end:
817 // CHECK3-NEXT: [[COND:%.*]] = phi i32 [ [[TMP10]], [[COND_TRUE]] ], [ [[TMP11]], [[COND_FALSE]] ]
818 // CHECK3-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
819 // CHECK3-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
820 // CHECK3-NEXT: store i32 [[TMP12]], ptr [[DOTOMP_IV]], align 4
821 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
822 // CHECK3: omp.inner.for.cond:
823 // CHECK3-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
824 // CHECK3-NEXT: [[TMP14:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
825 // CHECK3-NEXT: [[CMP5:%.*]] = icmp sle i32 [[TMP13]], [[TMP14]]
826 // CHECK3-NEXT: br i1 [[CMP5]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
827 // CHECK3: omp.inner.for.body:
828 // CHECK3-NEXT: [[TMP15:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
829 // CHECK3-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP15]], 1
830 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
831 // CHECK3-NEXT: store i32 [[ADD]], ptr [[I3]], align 4
832 // CHECK3-NEXT: [[TMP16:%.*]] = load i32, ptr [[I3]], align 4
833 // CHECK3-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [100 x i32], ptr [[TMP1]], i32 0, i32 [[TMP16]]
834 // CHECK3-NEXT: store i32 0, ptr [[ARRAYIDX]], align 4
835 // CHECK3-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
836 // CHECK3: omp.body.continue:
837 // CHECK3-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
838 // CHECK3: omp.inner.for.inc:
839 // CHECK3-NEXT: [[TMP17:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
840 // CHECK3-NEXT: [[ADD6:%.*]] = add nsw i32 [[TMP17]], 1
841 // CHECK3-NEXT: store i32 [[ADD6]], ptr [[DOTOMP_IV]], align 4
842 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND]]
843 // CHECK3: omp.inner.for.end:
844 // CHECK3-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
845 // CHECK3: omp.loop.exit:
846 // CHECK3-NEXT: [[TMP18:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 4
847 // CHECK3-NEXT: [[TMP19:%.*]] = load i32, ptr [[TMP18]], align 4
848 // CHECK3-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP19]])
849 // CHECK3-NEXT: br label [[OMP_PRECOND_END]]
850 // CHECK3: omp.precond.end:
851 // CHECK3-NEXT: ret void
854 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z21teams_argument_globali_l34
855 // CHECK3-SAME: (i32 noundef [[N:%.*]], ptr noundef nonnull align 4 dereferenceable(400) [[A:%.*]]) #[[ATTR1]] {
856 // CHECK3-NEXT: entry:
857 // CHECK3-NEXT: [[N_ADDR:%.*]] = alloca i32, align 4
858 // CHECK3-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 4
859 // CHECK3-NEXT: store i32 [[N]], ptr [[N_ADDR]], align 4
860 // CHECK3-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 4
861 // CHECK3-NEXT: [[TMP0:%.*]] = load ptr, ptr [[A_ADDR]], align 4
862 // CHECK3-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB2]], i32 2, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z21teams_argument_globali_l34.omp_outlined, ptr [[N_ADDR]], ptr [[TMP0]])
863 // CHECK3-NEXT: ret void
866 // CHECK3-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z21teams_argument_globali_l34.omp_outlined
867 // CHECK3-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[N:%.*]], ptr noundef nonnull align 4 dereferenceable(400) [[A:%.*]]) #[[ATTR1]] {
868 // CHECK3-NEXT: entry:
869 // CHECK3-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 4
870 // CHECK3-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 4
871 // CHECK3-NEXT: [[N_ADDR:%.*]] = alloca ptr, align 4
872 // CHECK3-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 4
873 // CHECK3-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
874 // CHECK3-NEXT: [[TMP:%.*]] = alloca i32, align 4
875 // CHECK3-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
876 // CHECK3-NEXT: [[DOTCAPTURE_EXPR_1:%.*]] = alloca i32, align 4
877 // CHECK3-NEXT: [[I:%.*]] = alloca i32, align 4
878 // CHECK3-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
879 // CHECK3-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
880 // CHECK3-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
881 // CHECK3-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
882 // CHECK3-NEXT: [[I3:%.*]] = alloca i32, align 4
883 // CHECK3-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 4
884 // CHECK3-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 4
885 // CHECK3-NEXT: store ptr [[N]], ptr [[N_ADDR]], align 4
886 // CHECK3-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 4
887 // CHECK3-NEXT: [[TMP0:%.*]] = load ptr, ptr [[N_ADDR]], align 4
888 // CHECK3-NEXT: [[TMP1:%.*]] = load ptr, ptr [[A_ADDR]], align 4
889 // CHECK3-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP0]], align 4
890 // CHECK3-NEXT: store i32 [[TMP2]], ptr [[DOTCAPTURE_EXPR_]], align 4
891 // CHECK3-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
892 // CHECK3-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP3]], 0
893 // CHECK3-NEXT: [[DIV:%.*]] = sdiv i32 [[SUB]], 1
894 // CHECK3-NEXT: [[SUB2:%.*]] = sub nsw i32 [[DIV]], 1
895 // CHECK3-NEXT: store i32 [[SUB2]], ptr [[DOTCAPTURE_EXPR_1]], align 4
896 // CHECK3-NEXT: store i32 0, ptr [[I]], align 4
897 // CHECK3-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
898 // CHECK3-NEXT: [[CMP:%.*]] = icmp slt i32 0, [[TMP4]]
899 // CHECK3-NEXT: br i1 [[CMP]], label [[OMP_PRECOND_THEN:%.*]], label [[OMP_PRECOND_END:%.*]]
900 // CHECK3: omp.precond.then:
901 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
902 // CHECK3-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
903 // CHECK3-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_COMB_UB]], align 4
904 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
905 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
906 // CHECK3-NEXT: [[TMP6:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 4
907 // CHECK3-NEXT: [[TMP7:%.*]] = load i32, ptr [[TMP6]], align 4
908 // CHECK3-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1]], i32 [[TMP7]], i32 92, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_COMB_LB]], ptr [[DOTOMP_COMB_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
909 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
910 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
911 // CHECK3-NEXT: [[CMP4:%.*]] = icmp sgt i32 [[TMP8]], [[TMP9]]
912 // CHECK3-NEXT: br i1 [[CMP4]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
913 // CHECK3: cond.true:
914 // CHECK3-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
915 // CHECK3-NEXT: br label [[COND_END:%.*]]
916 // CHECK3: cond.false:
917 // CHECK3-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
918 // CHECK3-NEXT: br label [[COND_END]]
919 // CHECK3: cond.end:
920 // CHECK3-NEXT: [[COND:%.*]] = phi i32 [ [[TMP10]], [[COND_TRUE]] ], [ [[TMP11]], [[COND_FALSE]] ]
921 // CHECK3-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
922 // CHECK3-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
923 // CHECK3-NEXT: store i32 [[TMP12]], ptr [[DOTOMP_IV]], align 4
924 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
925 // CHECK3: omp.inner.for.cond:
926 // CHECK3-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
927 // CHECK3-NEXT: [[TMP14:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
928 // CHECK3-NEXT: [[CMP5:%.*]] = icmp sle i32 [[TMP13]], [[TMP14]]
929 // CHECK3-NEXT: br i1 [[CMP5]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
930 // CHECK3: omp.inner.for.body:
931 // CHECK3-NEXT: [[TMP15:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
932 // CHECK3-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP15]], 1
933 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
934 // CHECK3-NEXT: store i32 [[ADD]], ptr [[I3]], align 4
935 // CHECK3-NEXT: [[TMP16:%.*]] = load i32, ptr [[I3]], align 4
936 // CHECK3-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [100 x i32], ptr [[TMP1]], i32 0, i32 [[TMP16]]
937 // CHECK3-NEXT: store i32 0, ptr [[ARRAYIDX]], align 4
938 // CHECK3-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
939 // CHECK3: omp.body.continue:
940 // CHECK3-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
941 // CHECK3: omp.inner.for.inc:
942 // CHECK3-NEXT: [[TMP17:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
943 // CHECK3-NEXT: [[ADD6:%.*]] = add nsw i32 [[TMP17]], 1
944 // CHECK3-NEXT: store i32 [[ADD6]], ptr [[DOTOMP_IV]], align 4
945 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND]]
946 // CHECK3: omp.inner.for.end:
947 // CHECK3-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
948 // CHECK3: omp.loop.exit:
949 // CHECK3-NEXT: [[TMP18:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 4
950 // CHECK3-NEXT: [[TMP19:%.*]] = load i32, ptr [[TMP18]], align 4
951 // CHECK3-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP19]])
952 // CHECK3-NEXT: br label [[OMP_PRECOND_END]]
953 // CHECK3: omp.precond.end:
954 // CHECK3-NEXT: ret void
957 // CHECK9-LABEL: define {{[^@]+}}@_Z15teams_local_argv
958 // CHECK9-SAME: () #[[ATTR0:[0-9]+]] {
959 // CHECK9-NEXT: entry:
960 // CHECK9-NEXT: [[N:%.*]] = alloca i32, align 4
961 // CHECK9-NEXT: [[SAVED_STACK:%.*]] = alloca ptr, align 8
962 // CHECK9-NEXT: [[__VLA_EXPR0:%.*]] = alloca i64, align 8
963 // CHECK9-NEXT: [[N_CASTED:%.*]] = alloca i64, align 8
964 // CHECK9-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [3 x ptr], align 8
965 // CHECK9-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [3 x ptr], align 8
966 // CHECK9-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [3 x ptr], align 8
967 // CHECK9-NEXT: [[DOTOFFLOAD_SIZES:%.*]] = alloca [3 x i64], align 8
968 // CHECK9-NEXT: [[TMP:%.*]] = alloca i32, align 4
969 // CHECK9-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
970 // CHECK9-NEXT: [[DOTCAPTURE_EXPR_1:%.*]] = alloca i32, align 4
971 // CHECK9-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
972 // CHECK9-NEXT: store i32 100, ptr [[N]], align 4
973 // CHECK9-NEXT: [[TMP0:%.*]] = load i32, ptr [[N]], align 4
974 // CHECK9-NEXT: [[TMP1:%.*]] = zext i32 [[TMP0]] to i64
975 // CHECK9-NEXT: [[TMP2:%.*]] = call ptr @llvm.stacksave.p0()
976 // CHECK9-NEXT: store ptr [[TMP2]], ptr [[SAVED_STACK]], align 8
977 // CHECK9-NEXT: [[VLA:%.*]] = alloca i32, i64 [[TMP1]], align 4
978 // CHECK9-NEXT: store i64 [[TMP1]], ptr [[__VLA_EXPR0]], align 8
979 // CHECK9-NEXT: [[TMP3:%.*]] = load i32, ptr [[N]], align 4
980 // CHECK9-NEXT: store i32 [[TMP3]], ptr [[N_CASTED]], align 4
981 // CHECK9-NEXT: [[TMP4:%.*]] = load i64, ptr [[N_CASTED]], align 8
982 // CHECK9-NEXT: [[TMP5:%.*]] = mul nuw i64 [[TMP1]], 4
983 // CHECK9-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[DOTOFFLOAD_SIZES]], ptr align 8 @.offload_sizes, i64 24, i1 false)
984 // CHECK9-NEXT: [[TMP6:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
985 // CHECK9-NEXT: store i64 [[TMP4]], ptr [[TMP6]], align 8
986 // CHECK9-NEXT: [[TMP7:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
987 // CHECK9-NEXT: store i64 [[TMP4]], ptr [[TMP7]], align 8
988 // CHECK9-NEXT: [[TMP8:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 0
989 // CHECK9-NEXT: store ptr null, ptr [[TMP8]], align 8
990 // CHECK9-NEXT: [[TMP9:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 1
991 // CHECK9-NEXT: store i64 [[TMP1]], ptr [[TMP9]], align 8
992 // CHECK9-NEXT: [[TMP10:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 1
993 // CHECK9-NEXT: store i64 [[TMP1]], ptr [[TMP10]], align 8
994 // CHECK9-NEXT: [[TMP11:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 1
995 // CHECK9-NEXT: store ptr null, ptr [[TMP11]], align 8
996 // CHECK9-NEXT: [[TMP12:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 2
997 // CHECK9-NEXT: store ptr [[VLA]], ptr [[TMP12]], align 8
998 // CHECK9-NEXT: [[TMP13:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 2
999 // CHECK9-NEXT: store ptr [[VLA]], ptr [[TMP13]], align 8
1000 // CHECK9-NEXT: [[TMP14:%.*]] = getelementptr inbounds [3 x i64], ptr [[DOTOFFLOAD_SIZES]], i32 0, i32 2
1001 // CHECK9-NEXT: store i64 [[TMP5]], ptr [[TMP14]], align 8
1002 // CHECK9-NEXT: [[TMP15:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 2
1003 // CHECK9-NEXT: store ptr null, ptr [[TMP15]], align 8
1004 // CHECK9-NEXT: [[TMP16:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
1005 // CHECK9-NEXT: [[TMP17:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
1006 // CHECK9-NEXT: [[TMP18:%.*]] = getelementptr inbounds [3 x i64], ptr [[DOTOFFLOAD_SIZES]], i32 0, i32 0
1007 // CHECK9-NEXT: [[TMP19:%.*]] = load i32, ptr [[N]], align 4
1008 // CHECK9-NEXT: store i32 [[TMP19]], ptr [[DOTCAPTURE_EXPR_]], align 4
1009 // CHECK9-NEXT: [[TMP20:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
1010 // CHECK9-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP20]], 0
1011 // CHECK9-NEXT: [[DIV:%.*]] = sdiv i32 [[SUB]], 1
1012 // CHECK9-NEXT: [[SUB2:%.*]] = sub nsw i32 [[DIV]], 1
1013 // CHECK9-NEXT: store i32 [[SUB2]], ptr [[DOTCAPTURE_EXPR_1]], align 4
1014 // CHECK9-NEXT: [[TMP21:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
1015 // CHECK9-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP21]], 1
1016 // CHECK9-NEXT: [[TMP22:%.*]] = zext i32 [[ADD]] to i64
1017 // CHECK9-NEXT: [[TMP23:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
1018 // CHECK9-NEXT: store i32 3, ptr [[TMP23]], align 4
1019 // CHECK9-NEXT: [[TMP24:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
1020 // CHECK9-NEXT: store i32 3, ptr [[TMP24]], align 4
1021 // CHECK9-NEXT: [[TMP25:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
1022 // CHECK9-NEXT: store ptr [[TMP16]], ptr [[TMP25]], align 8
1023 // CHECK9-NEXT: [[TMP26:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
1024 // CHECK9-NEXT: store ptr [[TMP17]], ptr [[TMP26]], align 8
1025 // CHECK9-NEXT: [[TMP27:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
1026 // CHECK9-NEXT: store ptr [[TMP18]], ptr [[TMP27]], align 8
1027 // CHECK9-NEXT: [[TMP28:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
1028 // CHECK9-NEXT: store ptr @.offload_maptypes, ptr [[TMP28]], align 8
1029 // CHECK9-NEXT: [[TMP29:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
1030 // CHECK9-NEXT: store ptr null, ptr [[TMP29]], align 8
1031 // CHECK9-NEXT: [[TMP30:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
1032 // CHECK9-NEXT: store ptr null, ptr [[TMP30]], align 8
1033 // CHECK9-NEXT: [[TMP31:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
1034 // CHECK9-NEXT: store i64 [[TMP22]], ptr [[TMP31]], align 8
1035 // CHECK9-NEXT: [[TMP32:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
1036 // CHECK9-NEXT: store i64 0, ptr [[TMP32]], align 8
1037 // CHECK9-NEXT: [[TMP33:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
1038 // CHECK9-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP33]], align 4
1039 // CHECK9-NEXT: [[TMP34:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
1040 // CHECK9-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP34]], align 4
1041 // CHECK9-NEXT: [[TMP35:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
1042 // CHECK9-NEXT: store i32 0, ptr [[TMP35]], align 4
1043 // CHECK9-NEXT: [[TMP36:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB2:[0-9]+]], i64 -1, i32 0, i32 0, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z15teams_local_argv_l72.region_id, ptr [[KERNEL_ARGS]])
1044 // CHECK9-NEXT: [[TMP37:%.*]] = icmp ne i32 [[TMP36]], 0
1045 // CHECK9-NEXT: br i1 [[TMP37]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
1046 // CHECK9: omp_offload.failed:
1047 // CHECK9-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z15teams_local_argv_l72(i64 [[TMP4]], i64 [[TMP1]], ptr [[VLA]]) #[[ATTR3:[0-9]+]]
1048 // CHECK9-NEXT: br label [[OMP_OFFLOAD_CONT]]
1049 // CHECK9: omp_offload.cont:
1050 // CHECK9-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[VLA]], i64 0
1051 // CHECK9-NEXT: [[TMP38:%.*]] = load i32, ptr [[ARRAYIDX]], align 4
1052 // CHECK9-NEXT: [[TMP39:%.*]] = load ptr, ptr [[SAVED_STACK]], align 8
1053 // CHECK9-NEXT: call void @llvm.stackrestore.p0(ptr [[TMP39]])
1054 // CHECK9-NEXT: ret i32 [[TMP38]]
1057 // CHECK9-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z15teams_local_argv_l72
1058 // CHECK9-SAME: (i64 noundef [[N:%.*]], i64 noundef [[VLA:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[A:%.*]]) #[[ATTR2:[0-9]+]] {
1059 // CHECK9-NEXT: entry:
1060 // CHECK9-NEXT: [[N_ADDR:%.*]] = alloca i64, align 8
1061 // CHECK9-NEXT: [[VLA_ADDR:%.*]] = alloca i64, align 8
1062 // CHECK9-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
1063 // CHECK9-NEXT: store i64 [[N]], ptr [[N_ADDR]], align 8
1064 // CHECK9-NEXT: store i64 [[VLA]], ptr [[VLA_ADDR]], align 8
1065 // CHECK9-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8
1066 // CHECK9-NEXT: [[TMP0:%.*]] = load i64, ptr [[VLA_ADDR]], align 8
1067 // CHECK9-NEXT: [[TMP1:%.*]] = load ptr, ptr [[A_ADDR]], align 8
1068 // CHECK9-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB2]], i32 3, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z15teams_local_argv_l72.omp_outlined, ptr [[N_ADDR]], i64 [[TMP0]], ptr [[TMP1]])
1069 // CHECK9-NEXT: ret void
1072 // CHECK9-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z15teams_local_argv_l72.omp_outlined
1073 // CHECK9-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[N:%.*]], i64 noundef [[VLA:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[A:%.*]]) #[[ATTR2]] {
1074 // CHECK9-NEXT: entry:
1075 // CHECK9-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
1076 // CHECK9-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
1077 // CHECK9-NEXT: [[N_ADDR:%.*]] = alloca ptr, align 8
1078 // CHECK9-NEXT: [[VLA_ADDR:%.*]] = alloca i64, align 8
1079 // CHECK9-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
1080 // CHECK9-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
1081 // CHECK9-NEXT: [[TMP:%.*]] = alloca i32, align 4
1082 // CHECK9-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
1083 // CHECK9-NEXT: [[DOTCAPTURE_EXPR_1:%.*]] = alloca i32, align 4
1084 // CHECK9-NEXT: [[I:%.*]] = alloca i32, align 4
1085 // CHECK9-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
1086 // CHECK9-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
1087 // CHECK9-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
1088 // CHECK9-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
1089 // CHECK9-NEXT: [[I3:%.*]] = alloca i32, align 4
1090 // CHECK9-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
1091 // CHECK9-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
1092 // CHECK9-NEXT: store ptr [[N]], ptr [[N_ADDR]], align 8
1093 // CHECK9-NEXT: store i64 [[VLA]], ptr [[VLA_ADDR]], align 8
1094 // CHECK9-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8
1095 // CHECK9-NEXT: [[TMP0:%.*]] = load ptr, ptr [[N_ADDR]], align 8
1096 // CHECK9-NEXT: [[TMP1:%.*]] = load i64, ptr [[VLA_ADDR]], align 8
1097 // CHECK9-NEXT: [[TMP2:%.*]] = load ptr, ptr [[A_ADDR]], align 8
1098 // CHECK9-NEXT: [[TMP3:%.*]] = load i32, ptr [[TMP0]], align 4
1099 // CHECK9-NEXT: store i32 [[TMP3]], ptr [[DOTCAPTURE_EXPR_]], align 4
1100 // CHECK9-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
1101 // CHECK9-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP4]], 0
1102 // CHECK9-NEXT: [[DIV:%.*]] = sdiv i32 [[SUB]], 1
1103 // CHECK9-NEXT: [[SUB2:%.*]] = sub nsw i32 [[DIV]], 1
1104 // CHECK9-NEXT: store i32 [[SUB2]], ptr [[DOTCAPTURE_EXPR_1]], align 4
1105 // CHECK9-NEXT: store i32 0, ptr [[I]], align 4
1106 // CHECK9-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
1107 // CHECK9-NEXT: [[CMP:%.*]] = icmp slt i32 0, [[TMP5]]
1108 // CHECK9-NEXT: br i1 [[CMP]], label [[OMP_PRECOND_THEN:%.*]], label [[OMP_PRECOND_END:%.*]]
1109 // CHECK9: omp.precond.then:
1110 // CHECK9-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
1111 // CHECK9-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
1112 // CHECK9-NEXT: store i32 [[TMP6]], ptr [[DOTOMP_COMB_UB]], align 4
1113 // CHECK9-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
1114 // CHECK9-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
1115 // CHECK9-NEXT: [[TMP7:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
1116 // CHECK9-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
1117 // CHECK9-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1:[0-9]+]], i32 [[TMP8]], i32 92, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_COMB_LB]], ptr [[DOTOMP_COMB_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
1118 // CHECK9-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1119 // CHECK9-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
1120 // CHECK9-NEXT: [[CMP4:%.*]] = icmp sgt i32 [[TMP9]], [[TMP10]]
1121 // CHECK9-NEXT: br i1 [[CMP4]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
1122 // CHECK9: cond.true:
1123 // CHECK9-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
1124 // CHECK9-NEXT: br label [[COND_END:%.*]]
1125 // CHECK9: cond.false:
1126 // CHECK9-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1127 // CHECK9-NEXT: br label [[COND_END]]
1128 // CHECK9: cond.end:
1129 // CHECK9-NEXT: [[COND:%.*]] = phi i32 [ [[TMP11]], [[COND_TRUE]] ], [ [[TMP12]], [[COND_FALSE]] ]
1130 // CHECK9-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
1131 // CHECK9-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
1132 // CHECK9-NEXT: store i32 [[TMP13]], ptr [[DOTOMP_IV]], align 4
1133 // CHECK9-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
1134 // CHECK9: omp.inner.for.cond:
1135 // CHECK9-NEXT: [[TMP14:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1136 // CHECK9-NEXT: [[TMP15:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1137 // CHECK9-NEXT: [[CMP5:%.*]] = icmp sle i32 [[TMP14]], [[TMP15]]
1138 // CHECK9-NEXT: br i1 [[CMP5]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
1139 // CHECK9: omp.inner.for.body:
1140 // CHECK9-NEXT: [[TMP16:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1141 // CHECK9-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP16]], 1
1142 // CHECK9-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
1143 // CHECK9-NEXT: store i32 [[ADD]], ptr [[I3]], align 4
1144 // CHECK9-NEXT: [[TMP17:%.*]] = load i32, ptr [[I3]], align 4
1145 // CHECK9-NEXT: [[IDXPROM:%.*]] = sext i32 [[TMP17]] to i64
1146 // CHECK9-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[TMP2]], i64 [[IDXPROM]]
1147 // CHECK9-NEXT: store i32 0, ptr [[ARRAYIDX]], align 4
1148 // CHECK9-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
1149 // CHECK9: omp.body.continue:
1150 // CHECK9-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
1151 // CHECK9: omp.inner.for.inc:
1152 // CHECK9-NEXT: [[TMP18:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1153 // CHECK9-NEXT: [[ADD6:%.*]] = add nsw i32 [[TMP18]], 1
1154 // CHECK9-NEXT: store i32 [[ADD6]], ptr [[DOTOMP_IV]], align 4
1155 // CHECK9-NEXT: br label [[OMP_INNER_FOR_COND]]
1156 // CHECK9: omp.inner.for.end:
1157 // CHECK9-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
1158 // CHECK9: omp.loop.exit:
1159 // CHECK9-NEXT: [[TMP19:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
1160 // CHECK9-NEXT: [[TMP20:%.*]] = load i32, ptr [[TMP19]], align 4
1161 // CHECK9-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP20]])
1162 // CHECK9-NEXT: br label [[OMP_PRECOND_END]]
1163 // CHECK9: omp.precond.end:
1164 // CHECK9-NEXT: ret void
1167 // CHECK11-LABEL: define {{[^@]+}}@_Z15teams_local_argv
1168 // CHECK11-SAME: () #[[ATTR0:[0-9]+]] {
1169 // CHECK11-NEXT: entry:
1170 // CHECK11-NEXT: [[N:%.*]] = alloca i32, align 4
1171 // CHECK11-NEXT: [[SAVED_STACK:%.*]] = alloca ptr, align 4
1172 // CHECK11-NEXT: [[__VLA_EXPR0:%.*]] = alloca i32, align 4
1173 // CHECK11-NEXT: [[N_CASTED:%.*]] = alloca i32, align 4
1174 // CHECK11-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [3 x ptr], align 4
1175 // CHECK11-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [3 x ptr], align 4
1176 // CHECK11-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [3 x ptr], align 4
1177 // CHECK11-NEXT: [[DOTOFFLOAD_SIZES:%.*]] = alloca [3 x i64], align 4
1178 // CHECK11-NEXT: [[TMP:%.*]] = alloca i32, align 4
1179 // CHECK11-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
1180 // CHECK11-NEXT: [[DOTCAPTURE_EXPR_1:%.*]] = alloca i32, align 4
1181 // CHECK11-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
1182 // CHECK11-NEXT: store i32 100, ptr [[N]], align 4
1183 // CHECK11-NEXT: [[TMP0:%.*]] = load i32, ptr [[N]], align 4
1184 // CHECK11-NEXT: [[TMP1:%.*]] = call ptr @llvm.stacksave.p0()
1185 // CHECK11-NEXT: store ptr [[TMP1]], ptr [[SAVED_STACK]], align 4
1186 // CHECK11-NEXT: [[VLA:%.*]] = alloca i32, i32 [[TMP0]], align 4
1187 // CHECK11-NEXT: store i32 [[TMP0]], ptr [[__VLA_EXPR0]], align 4
1188 // CHECK11-NEXT: [[TMP2:%.*]] = load i32, ptr [[N]], align 4
1189 // CHECK11-NEXT: store i32 [[TMP2]], ptr [[N_CASTED]], align 4
1190 // CHECK11-NEXT: [[TMP3:%.*]] = load i32, ptr [[N_CASTED]], align 4
1191 // CHECK11-NEXT: [[TMP4:%.*]] = mul nuw i32 [[TMP0]], 4
1192 // CHECK11-NEXT: [[TMP5:%.*]] = sext i32 [[TMP4]] to i64
1193 // CHECK11-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 4 [[DOTOFFLOAD_SIZES]], ptr align 4 @.offload_sizes, i32 24, i1 false)
1194 // CHECK11-NEXT: [[TMP6:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
1195 // CHECK11-NEXT: store i32 [[TMP3]], ptr [[TMP6]], align 4
1196 // CHECK11-NEXT: [[TMP7:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
1197 // CHECK11-NEXT: store i32 [[TMP3]], ptr [[TMP7]], align 4
1198 // CHECK11-NEXT: [[TMP8:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i32 0, i32 0
1199 // CHECK11-NEXT: store ptr null, ptr [[TMP8]], align 4
1200 // CHECK11-NEXT: [[TMP9:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 1
1201 // CHECK11-NEXT: store i32 [[TMP0]], ptr [[TMP9]], align 4
1202 // CHECK11-NEXT: [[TMP10:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 1
1203 // CHECK11-NEXT: store i32 [[TMP0]], ptr [[TMP10]], align 4
1204 // CHECK11-NEXT: [[TMP11:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i32 0, i32 1
1205 // CHECK11-NEXT: store ptr null, ptr [[TMP11]], align 4
1206 // CHECK11-NEXT: [[TMP12:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 2
1207 // CHECK11-NEXT: store ptr [[VLA]], ptr [[TMP12]], align 4
1208 // CHECK11-NEXT: [[TMP13:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 2
1209 // CHECK11-NEXT: store ptr [[VLA]], ptr [[TMP13]], align 4
1210 // CHECK11-NEXT: [[TMP14:%.*]] = getelementptr inbounds [3 x i64], ptr [[DOTOFFLOAD_SIZES]], i32 0, i32 2
1211 // CHECK11-NEXT: store i64 [[TMP5]], ptr [[TMP14]], align 4
1212 // CHECK11-NEXT: [[TMP15:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i32 0, i32 2
1213 // CHECK11-NEXT: store ptr null, ptr [[TMP15]], align 4
1214 // CHECK11-NEXT: [[TMP16:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
1215 // CHECK11-NEXT: [[TMP17:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
1216 // CHECK11-NEXT: [[TMP18:%.*]] = getelementptr inbounds [3 x i64], ptr [[DOTOFFLOAD_SIZES]], i32 0, i32 0
1217 // CHECK11-NEXT: [[TMP19:%.*]] = load i32, ptr [[N]], align 4
1218 // CHECK11-NEXT: store i32 [[TMP19]], ptr [[DOTCAPTURE_EXPR_]], align 4
1219 // CHECK11-NEXT: [[TMP20:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
1220 // CHECK11-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP20]], 0
1221 // CHECK11-NEXT: [[DIV:%.*]] = sdiv i32 [[SUB]], 1
1222 // CHECK11-NEXT: [[SUB2:%.*]] = sub nsw i32 [[DIV]], 1
1223 // CHECK11-NEXT: store i32 [[SUB2]], ptr [[DOTCAPTURE_EXPR_1]], align 4
1224 // CHECK11-NEXT: [[TMP21:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
1225 // CHECK11-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP21]], 1
1226 // CHECK11-NEXT: [[TMP22:%.*]] = zext i32 [[ADD]] to i64
1227 // CHECK11-NEXT: [[TMP23:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
1228 // CHECK11-NEXT: store i32 3, ptr [[TMP23]], align 4
1229 // CHECK11-NEXT: [[TMP24:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
1230 // CHECK11-NEXT: store i32 3, ptr [[TMP24]], align 4
1231 // CHECK11-NEXT: [[TMP25:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
1232 // CHECK11-NEXT: store ptr [[TMP16]], ptr [[TMP25]], align 4
1233 // CHECK11-NEXT: [[TMP26:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
1234 // CHECK11-NEXT: store ptr [[TMP17]], ptr [[TMP26]], align 4
1235 // CHECK11-NEXT: [[TMP27:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
1236 // CHECK11-NEXT: store ptr [[TMP18]], ptr [[TMP27]], align 4
1237 // CHECK11-NEXT: [[TMP28:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
1238 // CHECK11-NEXT: store ptr @.offload_maptypes, ptr [[TMP28]], align 4
1239 // CHECK11-NEXT: [[TMP29:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
1240 // CHECK11-NEXT: store ptr null, ptr [[TMP29]], align 4
1241 // CHECK11-NEXT: [[TMP30:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
1242 // CHECK11-NEXT: store ptr null, ptr [[TMP30]], align 4
1243 // CHECK11-NEXT: [[TMP31:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
1244 // CHECK11-NEXT: store i64 [[TMP22]], ptr [[TMP31]], align 8
1245 // CHECK11-NEXT: [[TMP32:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
1246 // CHECK11-NEXT: store i64 0, ptr [[TMP32]], align 8
1247 // CHECK11-NEXT: [[TMP33:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
1248 // CHECK11-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP33]], align 4
1249 // CHECK11-NEXT: [[TMP34:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
1250 // CHECK11-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP34]], align 4
1251 // CHECK11-NEXT: [[TMP35:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
1252 // CHECK11-NEXT: store i32 0, ptr [[TMP35]], align 4
1253 // CHECK11-NEXT: [[TMP36:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB2:[0-9]+]], i64 -1, i32 0, i32 0, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z15teams_local_argv_l72.region_id, ptr [[KERNEL_ARGS]])
1254 // CHECK11-NEXT: [[TMP37:%.*]] = icmp ne i32 [[TMP36]], 0
1255 // CHECK11-NEXT: br i1 [[TMP37]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
1256 // CHECK11: omp_offload.failed:
1257 // CHECK11-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z15teams_local_argv_l72(i32 [[TMP3]], i32 [[TMP0]], ptr [[VLA]]) #[[ATTR3:[0-9]+]]
1258 // CHECK11-NEXT: br label [[OMP_OFFLOAD_CONT]]
1259 // CHECK11: omp_offload.cont:
1260 // CHECK11-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[VLA]], i32 0
1261 // CHECK11-NEXT: [[TMP38:%.*]] = load i32, ptr [[ARRAYIDX]], align 4
1262 // CHECK11-NEXT: [[TMP39:%.*]] = load ptr, ptr [[SAVED_STACK]], align 4
1263 // CHECK11-NEXT: call void @llvm.stackrestore.p0(ptr [[TMP39]])
1264 // CHECK11-NEXT: ret i32 [[TMP38]]
1267 // CHECK11-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z15teams_local_argv_l72
1268 // CHECK11-SAME: (i32 noundef [[N:%.*]], i32 noundef [[VLA:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[A:%.*]]) #[[ATTR2:[0-9]+]] {
1269 // CHECK11-NEXT: entry:
1270 // CHECK11-NEXT: [[N_ADDR:%.*]] = alloca i32, align 4
1271 // CHECK11-NEXT: [[VLA_ADDR:%.*]] = alloca i32, align 4
1272 // CHECK11-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 4
1273 // CHECK11-NEXT: store i32 [[N]], ptr [[N_ADDR]], align 4
1274 // CHECK11-NEXT: store i32 [[VLA]], ptr [[VLA_ADDR]], align 4
1275 // CHECK11-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 4
1276 // CHECK11-NEXT: [[TMP0:%.*]] = load i32, ptr [[VLA_ADDR]], align 4
1277 // CHECK11-NEXT: [[TMP1:%.*]] = load ptr, ptr [[A_ADDR]], align 4
1278 // CHECK11-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB2]], i32 3, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z15teams_local_argv_l72.omp_outlined, ptr [[N_ADDR]], i32 [[TMP0]], ptr [[TMP1]])
1279 // CHECK11-NEXT: ret void
1282 // CHECK11-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z15teams_local_argv_l72.omp_outlined
1283 // CHECK11-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[N:%.*]], i32 noundef [[VLA:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[A:%.*]]) #[[ATTR2]] {
1284 // CHECK11-NEXT: entry:
1285 // CHECK11-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 4
1286 // CHECK11-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 4
1287 // CHECK11-NEXT: [[N_ADDR:%.*]] = alloca ptr, align 4
1288 // CHECK11-NEXT: [[VLA_ADDR:%.*]] = alloca i32, align 4
1289 // CHECK11-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 4
1290 // CHECK11-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
1291 // CHECK11-NEXT: [[TMP:%.*]] = alloca i32, align 4
1292 // CHECK11-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
1293 // CHECK11-NEXT: [[DOTCAPTURE_EXPR_1:%.*]] = alloca i32, align 4
1294 // CHECK11-NEXT: [[I:%.*]] = alloca i32, align 4
1295 // CHECK11-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
1296 // CHECK11-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
1297 // CHECK11-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
1298 // CHECK11-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
1299 // CHECK11-NEXT: [[I3:%.*]] = alloca i32, align 4
1300 // CHECK11-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 4
1301 // CHECK11-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 4
1302 // CHECK11-NEXT: store ptr [[N]], ptr [[N_ADDR]], align 4
1303 // CHECK11-NEXT: store i32 [[VLA]], ptr [[VLA_ADDR]], align 4
1304 // CHECK11-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 4
1305 // CHECK11-NEXT: [[TMP0:%.*]] = load ptr, ptr [[N_ADDR]], align 4
1306 // CHECK11-NEXT: [[TMP1:%.*]] = load i32, ptr [[VLA_ADDR]], align 4
1307 // CHECK11-NEXT: [[TMP2:%.*]] = load ptr, ptr [[A_ADDR]], align 4
1308 // CHECK11-NEXT: [[TMP3:%.*]] = load i32, ptr [[TMP0]], align 4
1309 // CHECK11-NEXT: store i32 [[TMP3]], ptr [[DOTCAPTURE_EXPR_]], align 4
1310 // CHECK11-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
1311 // CHECK11-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP4]], 0
1312 // CHECK11-NEXT: [[DIV:%.*]] = sdiv i32 [[SUB]], 1
1313 // CHECK11-NEXT: [[SUB2:%.*]] = sub nsw i32 [[DIV]], 1
1314 // CHECK11-NEXT: store i32 [[SUB2]], ptr [[DOTCAPTURE_EXPR_1]], align 4
1315 // CHECK11-NEXT: store i32 0, ptr [[I]], align 4
1316 // CHECK11-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
1317 // CHECK11-NEXT: [[CMP:%.*]] = icmp slt i32 0, [[TMP5]]
1318 // CHECK11-NEXT: br i1 [[CMP]], label [[OMP_PRECOND_THEN:%.*]], label [[OMP_PRECOND_END:%.*]]
1319 // CHECK11: omp.precond.then:
1320 // CHECK11-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
1321 // CHECK11-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
1322 // CHECK11-NEXT: store i32 [[TMP6]], ptr [[DOTOMP_COMB_UB]], align 4
1323 // CHECK11-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
1324 // CHECK11-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
1325 // CHECK11-NEXT: [[TMP7:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 4
1326 // CHECK11-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
1327 // CHECK11-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1:[0-9]+]], i32 [[TMP8]], i32 92, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_COMB_LB]], ptr [[DOTOMP_COMB_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
1328 // CHECK11-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1329 // CHECK11-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
1330 // CHECK11-NEXT: [[CMP4:%.*]] = icmp sgt i32 [[TMP9]], [[TMP10]]
1331 // CHECK11-NEXT: br i1 [[CMP4]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
1332 // CHECK11: cond.true:
1333 // CHECK11-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
1334 // CHECK11-NEXT: br label [[COND_END:%.*]]
1335 // CHECK11: cond.false:
1336 // CHECK11-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1337 // CHECK11-NEXT: br label [[COND_END]]
1338 // CHECK11: cond.end:
1339 // CHECK11-NEXT: [[COND:%.*]] = phi i32 [ [[TMP11]], [[COND_TRUE]] ], [ [[TMP12]], [[COND_FALSE]] ]
1340 // CHECK11-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
1341 // CHECK11-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
1342 // CHECK11-NEXT: store i32 [[TMP13]], ptr [[DOTOMP_IV]], align 4
1343 // CHECK11-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
1344 // CHECK11: omp.inner.for.cond:
1345 // CHECK11-NEXT: [[TMP14:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1346 // CHECK11-NEXT: [[TMP15:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1347 // CHECK11-NEXT: [[CMP5:%.*]] = icmp sle i32 [[TMP14]], [[TMP15]]
1348 // CHECK11-NEXT: br i1 [[CMP5]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
1349 // CHECK11: omp.inner.for.body:
1350 // CHECK11-NEXT: [[TMP16:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1351 // CHECK11-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP16]], 1
1352 // CHECK11-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
1353 // CHECK11-NEXT: store i32 [[ADD]], ptr [[I3]], align 4
1354 // CHECK11-NEXT: [[TMP17:%.*]] = load i32, ptr [[I3]], align 4
1355 // CHECK11-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[TMP2]], i32 [[TMP17]]
1356 // CHECK11-NEXT: store i32 0, ptr [[ARRAYIDX]], align 4
1357 // CHECK11-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
1358 // CHECK11: omp.body.continue:
1359 // CHECK11-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
1360 // CHECK11: omp.inner.for.inc:
1361 // CHECK11-NEXT: [[TMP18:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1362 // CHECK11-NEXT: [[ADD6:%.*]] = add nsw i32 [[TMP18]], 1
1363 // CHECK11-NEXT: store i32 [[ADD6]], ptr [[DOTOMP_IV]], align 4
1364 // CHECK11-NEXT: br label [[OMP_INNER_FOR_COND]]
1365 // CHECK11: omp.inner.for.end:
1366 // CHECK11-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
1367 // CHECK11: omp.loop.exit:
1368 // CHECK11-NEXT: [[TMP19:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 4
1369 // CHECK11-NEXT: [[TMP20:%.*]] = load i32, ptr [[TMP19]], align 4
1370 // CHECK11-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP20]])
1371 // CHECK11-NEXT: br label [[OMP_PRECOND_END]]
1372 // CHECK11: omp.precond.end:
1373 // CHECK11-NEXT: ret void
1376 // CHECK17-LABEL: define {{[^@]+}}@_Z21teams_template_structv
1377 // CHECK17-SAME: () #[[ATTR0:[0-9]+]] {
1378 // CHECK17-NEXT: entry:
1379 // CHECK17-NEXT: [[V:%.*]] = alloca [[STRUCT_SS:%.*]], align 4
1380 // CHECK17-NEXT: [[CALL:%.*]] = call noundef signext i32 @_ZN2SSIiLi123ELx456EE3fooEv(ptr noundef nonnull align 4 dereferenceable(496) [[V]])
1381 // CHECK17-NEXT: ret i32 [[CALL]]
1384 // CHECK17-LABEL: define {{[^@]+}}@_ZN2SSIiLi123ELx456EE3fooEv
1385 // CHECK17-SAME: (ptr noundef nonnull align 4 dereferenceable(496) [[THIS:%.*]]) #[[ATTR0]] comdat {
1386 // CHECK17-NEXT: entry:
1387 // CHECK17-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8
1388 // CHECK17-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [1 x ptr], align 8
1389 // CHECK17-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [1 x ptr], align 8
1390 // CHECK17-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [1 x ptr], align 8
1391 // CHECK17-NEXT: [[TMP:%.*]] = alloca i32, align 4
1392 // CHECK17-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
1393 // CHECK17-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8
1394 // CHECK17-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8
1395 // CHECK17-NEXT: [[A:%.*]] = getelementptr inbounds nuw [[STRUCT_SS:%.*]], ptr [[THIS1]], i32 0, i32 0
1396 // CHECK17-NEXT: [[TMP0:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
1397 // CHECK17-NEXT: store ptr [[THIS1]], ptr [[TMP0]], align 8
1398 // CHECK17-NEXT: [[TMP1:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
1399 // CHECK17-NEXT: store ptr [[A]], ptr [[TMP1]], align 8
1400 // CHECK17-NEXT: [[TMP2:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 0
1401 // CHECK17-NEXT: store ptr null, ptr [[TMP2]], align 8
1402 // CHECK17-NEXT: [[TMP3:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
1403 // CHECK17-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
1404 // CHECK17-NEXT: [[TMP5:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
1405 // CHECK17-NEXT: store i32 3, ptr [[TMP5]], align 4
1406 // CHECK17-NEXT: [[TMP6:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
1407 // CHECK17-NEXT: store i32 1, ptr [[TMP6]], align 4
1408 // CHECK17-NEXT: [[TMP7:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
1409 // CHECK17-NEXT: store ptr [[TMP3]], ptr [[TMP7]], align 8
1410 // CHECK17-NEXT: [[TMP8:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
1411 // CHECK17-NEXT: store ptr [[TMP4]], ptr [[TMP8]], align 8
1412 // CHECK17-NEXT: [[TMP9:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
1413 // CHECK17-NEXT: store ptr @.offload_sizes, ptr [[TMP9]], align 8
1414 // CHECK17-NEXT: [[TMP10:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
1415 // CHECK17-NEXT: store ptr @.offload_maptypes, ptr [[TMP10]], align 8
1416 // CHECK17-NEXT: [[TMP11:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
1417 // CHECK17-NEXT: store ptr null, ptr [[TMP11]], align 8
1418 // CHECK17-NEXT: [[TMP12:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
1419 // CHECK17-NEXT: store ptr null, ptr [[TMP12]], align 8
1420 // CHECK17-NEXT: [[TMP13:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
1421 // CHECK17-NEXT: store i64 123, ptr [[TMP13]], align 8
1422 // CHECK17-NEXT: [[TMP14:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
1423 // CHECK17-NEXT: store i64 0, ptr [[TMP14]], align 8
1424 // CHECK17-NEXT: [[TMP15:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
1425 // CHECK17-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP15]], align 4
1426 // CHECK17-NEXT: [[TMP16:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
1427 // CHECK17-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP16]], align 4
1428 // CHECK17-NEXT: [[TMP17:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
1429 // CHECK17-NEXT: store i32 0, ptr [[TMP17]], align 4
1430 // CHECK17-NEXT: [[TMP18:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB2:[0-9]+]], i64 -1, i32 0, i32 0, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__ZN2SSIiLi123ELx456EE3fooEv_l108.region_id, ptr [[KERNEL_ARGS]])
1431 // CHECK17-NEXT: [[TMP19:%.*]] = icmp ne i32 [[TMP18]], 0
1432 // CHECK17-NEXT: br i1 [[TMP19]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
1433 // CHECK17: omp_offload.failed:
1434 // CHECK17-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__ZN2SSIiLi123ELx456EE3fooEv_l108(ptr [[THIS1]]) #[[ATTR2:[0-9]+]]
1435 // CHECK17-NEXT: br label [[OMP_OFFLOAD_CONT]]
1436 // CHECK17: omp_offload.cont:
1437 // CHECK17-NEXT: [[A2:%.*]] = getelementptr inbounds nuw [[STRUCT_SS]], ptr [[THIS1]], i32 0, i32 0
1438 // CHECK17-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [123 x i32], ptr [[A2]], i64 0, i64 0
1439 // CHECK17-NEXT: [[TMP20:%.*]] = load i32, ptr [[ARRAYIDX]], align 4
1440 // CHECK17-NEXT: ret i32 [[TMP20]]
1443 // CHECK17-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__ZN2SSIiLi123ELx456EE3fooEv_l108
1444 // CHECK17-SAME: (ptr noundef [[THIS:%.*]]) #[[ATTR1:[0-9]+]] {
1445 // CHECK17-NEXT: entry:
1446 // CHECK17-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8
1447 // CHECK17-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8
1448 // CHECK17-NEXT: [[TMP0:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8
1449 // CHECK17-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB2]], i32 1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__ZN2SSIiLi123ELx456EE3fooEv_l108.omp_outlined, ptr [[TMP0]])
1450 // CHECK17-NEXT: ret void
1453 // CHECK17-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__ZN2SSIiLi123ELx456EE3fooEv_l108.omp_outlined
1454 // CHECK17-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef [[THIS:%.*]]) #[[ATTR1]] {
1455 // CHECK17-NEXT: entry:
1456 // CHECK17-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
1457 // CHECK17-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
1458 // CHECK17-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 8
1459 // CHECK17-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
1460 // CHECK17-NEXT: [[TMP:%.*]] = alloca i32, align 4
1461 // CHECK17-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
1462 // CHECK17-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
1463 // CHECK17-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
1464 // CHECK17-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
1465 // CHECK17-NEXT: [[I:%.*]] = alloca i32, align 4
1466 // CHECK17-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
1467 // CHECK17-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
1468 // CHECK17-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 8
1469 // CHECK17-NEXT: [[TMP0:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8
1470 // CHECK17-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
1471 // CHECK17-NEXT: store i32 122, ptr [[DOTOMP_COMB_UB]], align 4
1472 // CHECK17-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
1473 // CHECK17-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
1474 // CHECK17-NEXT: [[TMP1:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
1475 // CHECK17-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP1]], align 4
1476 // CHECK17-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)
1477 // CHECK17-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1478 // CHECK17-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP3]], 122
1479 // CHECK17-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
1480 // CHECK17: cond.true:
1481 // CHECK17-NEXT: br label [[COND_END:%.*]]
1482 // CHECK17: cond.false:
1483 // CHECK17-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1484 // CHECK17-NEXT: br label [[COND_END]]
1485 // CHECK17: cond.end:
1486 // CHECK17-NEXT: [[COND:%.*]] = phi i32 [ 122, [[COND_TRUE]] ], [ [[TMP4]], [[COND_FALSE]] ]
1487 // CHECK17-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
1488 // CHECK17-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
1489 // CHECK17-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_IV]], align 4
1490 // CHECK17-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
1491 // CHECK17: omp.inner.for.cond:
1492 // CHECK17-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1493 // CHECK17-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1494 // CHECK17-NEXT: [[CMP1:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
1495 // CHECK17-NEXT: br i1 [[CMP1]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
1496 // CHECK17: omp.inner.for.body:
1497 // CHECK17-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1498 // CHECK17-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP8]], 1
1499 // CHECK17-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
1500 // CHECK17-NEXT: store i32 [[ADD]], ptr [[I]], align 4
1501 // CHECK17-NEXT: [[A:%.*]] = getelementptr inbounds nuw [[STRUCT_SS:%.*]], ptr [[TMP0]], i32 0, i32 0
1502 // CHECK17-NEXT: [[TMP9:%.*]] = load i32, ptr [[I]], align 4
1503 // CHECK17-NEXT: [[IDXPROM:%.*]] = sext i32 [[TMP9]] to i64
1504 // CHECK17-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [123 x i32], ptr [[A]], i64 0, i64 [[IDXPROM]]
1505 // CHECK17-NEXT: store i32 0, ptr [[ARRAYIDX]], align 4
1506 // CHECK17-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
1507 // CHECK17: omp.body.continue:
1508 // CHECK17-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
1509 // CHECK17: omp.inner.for.inc:
1510 // CHECK17-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1511 // CHECK17-NEXT: [[ADD2:%.*]] = add nsw i32 [[TMP10]], 1
1512 // CHECK17-NEXT: store i32 [[ADD2]], ptr [[DOTOMP_IV]], align 4
1513 // CHECK17-NEXT: br label [[OMP_INNER_FOR_COND]]
1514 // CHECK17: omp.inner.for.end:
1515 // CHECK17-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
1516 // CHECK17: omp.loop.exit:
1517 // CHECK17-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP2]])
1518 // CHECK17-NEXT: ret void
1521 // CHECK19-LABEL: define {{[^@]+}}@_Z21teams_template_structv
1522 // CHECK19-SAME: () #[[ATTR0:[0-9]+]] {
1523 // CHECK19-NEXT: entry:
1524 // CHECK19-NEXT: [[V:%.*]] = alloca [[STRUCT_SS:%.*]], align 4
1525 // CHECK19-NEXT: [[CALL:%.*]] = call noundef i32 @_ZN2SSIiLi123ELx456EE3fooEv(ptr noundef nonnull align 4 dereferenceable(496) [[V]])
1526 // CHECK19-NEXT: ret i32 [[CALL]]
1529 // CHECK19-LABEL: define {{[^@]+}}@_ZN2SSIiLi123ELx456EE3fooEv
1530 // CHECK19-SAME: (ptr noundef nonnull align 4 dereferenceable(496) [[THIS:%.*]]) #[[ATTR0]] comdat align 2 {
1531 // CHECK19-NEXT: entry:
1532 // CHECK19-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 4
1533 // CHECK19-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [1 x ptr], align 4
1534 // CHECK19-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [1 x ptr], align 4
1535 // CHECK19-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [1 x ptr], align 4
1536 // CHECK19-NEXT: [[TMP:%.*]] = alloca i32, align 4
1537 // CHECK19-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
1538 // CHECK19-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 4
1539 // CHECK19-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 4
1540 // CHECK19-NEXT: [[A:%.*]] = getelementptr inbounds nuw [[STRUCT_SS:%.*]], ptr [[THIS1]], i32 0, i32 0
1541 // CHECK19-NEXT: [[TMP0:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
1542 // CHECK19-NEXT: store ptr [[THIS1]], ptr [[TMP0]], align 4
1543 // CHECK19-NEXT: [[TMP1:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
1544 // CHECK19-NEXT: store ptr [[A]], ptr [[TMP1]], align 4
1545 // CHECK19-NEXT: [[TMP2:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i32 0, i32 0
1546 // CHECK19-NEXT: store ptr null, ptr [[TMP2]], align 4
1547 // CHECK19-NEXT: [[TMP3:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
1548 // CHECK19-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
1549 // CHECK19-NEXT: [[TMP5:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
1550 // CHECK19-NEXT: store i32 3, ptr [[TMP5]], align 4
1551 // CHECK19-NEXT: [[TMP6:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
1552 // CHECK19-NEXT: store i32 1, ptr [[TMP6]], align 4
1553 // CHECK19-NEXT: [[TMP7:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
1554 // CHECK19-NEXT: store ptr [[TMP3]], ptr [[TMP7]], align 4
1555 // CHECK19-NEXT: [[TMP8:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
1556 // CHECK19-NEXT: store ptr [[TMP4]], ptr [[TMP8]], align 4
1557 // CHECK19-NEXT: [[TMP9:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
1558 // CHECK19-NEXT: store ptr @.offload_sizes, ptr [[TMP9]], align 4
1559 // CHECK19-NEXT: [[TMP10:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
1560 // CHECK19-NEXT: store ptr @.offload_maptypes, ptr [[TMP10]], align 4
1561 // CHECK19-NEXT: [[TMP11:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
1562 // CHECK19-NEXT: store ptr null, ptr [[TMP11]], align 4
1563 // CHECK19-NEXT: [[TMP12:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
1564 // CHECK19-NEXT: store ptr null, ptr [[TMP12]], align 4
1565 // CHECK19-NEXT: [[TMP13:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
1566 // CHECK19-NEXT: store i64 123, ptr [[TMP13]], align 8
1567 // CHECK19-NEXT: [[TMP14:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
1568 // CHECK19-NEXT: store i64 0, ptr [[TMP14]], align 8
1569 // CHECK19-NEXT: [[TMP15:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
1570 // CHECK19-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP15]], align 4
1571 // CHECK19-NEXT: [[TMP16:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
1572 // CHECK19-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP16]], align 4
1573 // CHECK19-NEXT: [[TMP17:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
1574 // CHECK19-NEXT: store i32 0, ptr [[TMP17]], align 4
1575 // CHECK19-NEXT: [[TMP18:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB2:[0-9]+]], i64 -1, i32 0, i32 0, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__ZN2SSIiLi123ELx456EE3fooEv_l108.region_id, ptr [[KERNEL_ARGS]])
1576 // CHECK19-NEXT: [[TMP19:%.*]] = icmp ne i32 [[TMP18]], 0
1577 // CHECK19-NEXT: br i1 [[TMP19]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
1578 // CHECK19: omp_offload.failed:
1579 // CHECK19-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__ZN2SSIiLi123ELx456EE3fooEv_l108(ptr [[THIS1]]) #[[ATTR2:[0-9]+]]
1580 // CHECK19-NEXT: br label [[OMP_OFFLOAD_CONT]]
1581 // CHECK19: omp_offload.cont:
1582 // CHECK19-NEXT: [[A2:%.*]] = getelementptr inbounds nuw [[STRUCT_SS]], ptr [[THIS1]], i32 0, i32 0
1583 // CHECK19-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [123 x i32], ptr [[A2]], i32 0, i32 0
1584 // CHECK19-NEXT: [[TMP20:%.*]] = load i32, ptr [[ARRAYIDX]], align 4
1585 // CHECK19-NEXT: ret i32 [[TMP20]]
1588 // CHECK19-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__ZN2SSIiLi123ELx456EE3fooEv_l108
1589 // CHECK19-SAME: (ptr noundef [[THIS:%.*]]) #[[ATTR1:[0-9]+]] {
1590 // CHECK19-NEXT: entry:
1591 // CHECK19-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 4
1592 // CHECK19-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 4
1593 // CHECK19-NEXT: [[TMP0:%.*]] = load ptr, ptr [[THIS_ADDR]], align 4
1594 // CHECK19-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB2]], i32 1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__ZN2SSIiLi123ELx456EE3fooEv_l108.omp_outlined, ptr [[TMP0]])
1595 // CHECK19-NEXT: ret void
1598 // CHECK19-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__ZN2SSIiLi123ELx456EE3fooEv_l108.omp_outlined
1599 // CHECK19-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef [[THIS:%.*]]) #[[ATTR1]] {
1600 // CHECK19-NEXT: entry:
1601 // CHECK19-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 4
1602 // CHECK19-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 4
1603 // CHECK19-NEXT: [[THIS_ADDR:%.*]] = alloca ptr, align 4
1604 // CHECK19-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
1605 // CHECK19-NEXT: [[TMP:%.*]] = alloca i32, align 4
1606 // CHECK19-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
1607 // CHECK19-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
1608 // CHECK19-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
1609 // CHECK19-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
1610 // CHECK19-NEXT: [[I:%.*]] = alloca i32, align 4
1611 // CHECK19-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 4
1612 // CHECK19-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 4
1613 // CHECK19-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]], align 4
1614 // CHECK19-NEXT: [[TMP0:%.*]] = load ptr, ptr [[THIS_ADDR]], align 4
1615 // CHECK19-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
1616 // CHECK19-NEXT: store i32 122, ptr [[DOTOMP_COMB_UB]], align 4
1617 // CHECK19-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
1618 // CHECK19-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
1619 // CHECK19-NEXT: [[TMP1:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 4
1620 // CHECK19-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP1]], align 4
1621 // CHECK19-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)
1622 // CHECK19-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1623 // CHECK19-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP3]], 122
1624 // CHECK19-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
1625 // CHECK19: cond.true:
1626 // CHECK19-NEXT: br label [[COND_END:%.*]]
1627 // CHECK19: cond.false:
1628 // CHECK19-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1629 // CHECK19-NEXT: br label [[COND_END]]
1630 // CHECK19: cond.end:
1631 // CHECK19-NEXT: [[COND:%.*]] = phi i32 [ 122, [[COND_TRUE]] ], [ [[TMP4]], [[COND_FALSE]] ]
1632 // CHECK19-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
1633 // CHECK19-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
1634 // CHECK19-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_IV]], align 4
1635 // CHECK19-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
1636 // CHECK19: omp.inner.for.cond:
1637 // CHECK19-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1638 // CHECK19-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1639 // CHECK19-NEXT: [[CMP1:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
1640 // CHECK19-NEXT: br i1 [[CMP1]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
1641 // CHECK19: omp.inner.for.body:
1642 // CHECK19-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1643 // CHECK19-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP8]], 1
1644 // CHECK19-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
1645 // CHECK19-NEXT: store i32 [[ADD]], ptr [[I]], align 4
1646 // CHECK19-NEXT: [[A:%.*]] = getelementptr inbounds nuw [[STRUCT_SS:%.*]], ptr [[TMP0]], i32 0, i32 0
1647 // CHECK19-NEXT: [[TMP9:%.*]] = load i32, ptr [[I]], align 4
1648 // CHECK19-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [123 x i32], ptr [[A]], i32 0, i32 [[TMP9]]
1649 // CHECK19-NEXT: store i32 0, ptr [[ARRAYIDX]], align 4
1650 // CHECK19-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
1651 // CHECK19: omp.body.continue:
1652 // CHECK19-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
1653 // CHECK19: omp.inner.for.inc:
1654 // CHECK19-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1655 // CHECK19-NEXT: [[ADD2:%.*]] = add nsw i32 [[TMP10]], 1
1656 // CHECK19-NEXT: store i32 [[ADD2]], ptr [[DOTOMP_IV]], align 4
1657 // CHECK19-NEXT: br label [[OMP_INNER_FOR_COND]]
1658 // CHECK19: omp.inner.for.end:
1659 // CHECK19-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
1660 // CHECK19: omp.loop.exit:
1661 // CHECK19-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP2]])
1662 // CHECK19-NEXT: ret void
1665 // CHECK25-LABEL: define {{[^@]+}}@main
1666 // CHECK25-SAME: (i32 noundef signext [[ARGC:%.*]], ptr noundef [[ARGV:%.*]]) #[[ATTR0:[0-9]+]] {
1667 // CHECK25-NEXT: entry:
1668 // CHECK25-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
1669 // CHECK25-NEXT: [[ARGC_ADDR:%.*]] = alloca i32, align 4
1670 // CHECK25-NEXT: [[ARGV_ADDR:%.*]] = alloca ptr, align 8
1671 // CHECK25-NEXT: [[N:%.*]] = alloca i32, align 4
1672 // CHECK25-NEXT: [[SAVED_STACK:%.*]] = alloca ptr, align 8
1673 // CHECK25-NEXT: [[__VLA_EXPR0:%.*]] = alloca i64, align 8
1674 // CHECK25-NEXT: [[N_CASTED:%.*]] = alloca i64, align 8
1675 // CHECK25-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [3 x ptr], align 8
1676 // CHECK25-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [3 x ptr], align 8
1677 // CHECK25-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [3 x ptr], align 8
1678 // CHECK25-NEXT: [[DOTOFFLOAD_SIZES:%.*]] = alloca [3 x i64], align 8
1679 // CHECK25-NEXT: [[TMP:%.*]] = alloca i32, align 4
1680 // CHECK25-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
1681 // CHECK25-NEXT: [[DOTCAPTURE_EXPR_1:%.*]] = alloca i32, align 4
1682 // CHECK25-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
1683 // CHECK25-NEXT: store i32 0, ptr [[RETVAL]], align 4
1684 // CHECK25-NEXT: store i32 [[ARGC]], ptr [[ARGC_ADDR]], align 4
1685 // CHECK25-NEXT: store ptr [[ARGV]], ptr [[ARGV_ADDR]], align 8
1686 // CHECK25-NEXT: store i32 100, ptr [[N]], align 4
1687 // CHECK25-NEXT: [[TMP0:%.*]] = load i32, ptr [[N]], align 4
1688 // CHECK25-NEXT: [[TMP1:%.*]] = zext i32 [[TMP0]] to i64
1689 // CHECK25-NEXT: [[TMP2:%.*]] = call ptr @llvm.stacksave.p0()
1690 // CHECK25-NEXT: store ptr [[TMP2]], ptr [[SAVED_STACK]], align 8
1691 // CHECK25-NEXT: [[VLA:%.*]] = alloca i32, i64 [[TMP1]], align 4
1692 // CHECK25-NEXT: store i64 [[TMP1]], ptr [[__VLA_EXPR0]], align 8
1693 // CHECK25-NEXT: [[TMP3:%.*]] = load i32, ptr [[N]], align 4
1694 // CHECK25-NEXT: store i32 [[TMP3]], ptr [[N_CASTED]], align 4
1695 // CHECK25-NEXT: [[TMP4:%.*]] = load i64, ptr [[N_CASTED]], align 8
1696 // CHECK25-NEXT: [[TMP5:%.*]] = mul nuw i64 [[TMP1]], 4
1697 // CHECK25-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[DOTOFFLOAD_SIZES]], ptr align 8 @.offload_sizes, i64 24, i1 false)
1698 // CHECK25-NEXT: [[TMP6:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
1699 // CHECK25-NEXT: store i64 [[TMP4]], ptr [[TMP6]], align 8
1700 // CHECK25-NEXT: [[TMP7:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
1701 // CHECK25-NEXT: store i64 [[TMP4]], ptr [[TMP7]], align 8
1702 // CHECK25-NEXT: [[TMP8:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 0
1703 // CHECK25-NEXT: store ptr null, ptr [[TMP8]], align 8
1704 // CHECK25-NEXT: [[TMP9:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 1
1705 // CHECK25-NEXT: store i64 [[TMP1]], ptr [[TMP9]], align 8
1706 // CHECK25-NEXT: [[TMP10:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 1
1707 // CHECK25-NEXT: store i64 [[TMP1]], ptr [[TMP10]], align 8
1708 // CHECK25-NEXT: [[TMP11:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 1
1709 // CHECK25-NEXT: store ptr null, ptr [[TMP11]], align 8
1710 // CHECK25-NEXT: [[TMP12:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 2
1711 // CHECK25-NEXT: store ptr [[VLA]], ptr [[TMP12]], align 8
1712 // CHECK25-NEXT: [[TMP13:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 2
1713 // CHECK25-NEXT: store ptr [[VLA]], ptr [[TMP13]], align 8
1714 // CHECK25-NEXT: [[TMP14:%.*]] = getelementptr inbounds [3 x i64], ptr [[DOTOFFLOAD_SIZES]], i32 0, i32 2
1715 // CHECK25-NEXT: store i64 [[TMP5]], ptr [[TMP14]], align 8
1716 // CHECK25-NEXT: [[TMP15:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 2
1717 // CHECK25-NEXT: store ptr null, ptr [[TMP15]], align 8
1718 // CHECK25-NEXT: [[TMP16:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
1719 // CHECK25-NEXT: [[TMP17:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
1720 // CHECK25-NEXT: [[TMP18:%.*]] = getelementptr inbounds [3 x i64], ptr [[DOTOFFLOAD_SIZES]], i32 0, i32 0
1721 // CHECK25-NEXT: [[TMP19:%.*]] = load i32, ptr [[N]], align 4
1722 // CHECK25-NEXT: store i32 [[TMP19]], ptr [[DOTCAPTURE_EXPR_]], align 4
1723 // CHECK25-NEXT: [[TMP20:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
1724 // CHECK25-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP20]], 0
1725 // CHECK25-NEXT: [[DIV:%.*]] = sdiv i32 [[SUB]], 1
1726 // CHECK25-NEXT: [[SUB2:%.*]] = sub nsw i32 [[DIV]], 1
1727 // CHECK25-NEXT: store i32 [[SUB2]], ptr [[DOTCAPTURE_EXPR_1]], align 4
1728 // CHECK25-NEXT: [[TMP21:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
1729 // CHECK25-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP21]], 1
1730 // CHECK25-NEXT: [[TMP22:%.*]] = zext i32 [[ADD]] to i64
1731 // CHECK25-NEXT: [[TMP23:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
1732 // CHECK25-NEXT: store i32 3, ptr [[TMP23]], align 4
1733 // CHECK25-NEXT: [[TMP24:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
1734 // CHECK25-NEXT: store i32 3, ptr [[TMP24]], align 4
1735 // CHECK25-NEXT: [[TMP25:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
1736 // CHECK25-NEXT: store ptr [[TMP16]], ptr [[TMP25]], align 8
1737 // CHECK25-NEXT: [[TMP26:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
1738 // CHECK25-NEXT: store ptr [[TMP17]], ptr [[TMP26]], align 8
1739 // CHECK25-NEXT: [[TMP27:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
1740 // CHECK25-NEXT: store ptr [[TMP18]], ptr [[TMP27]], align 8
1741 // CHECK25-NEXT: [[TMP28:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
1742 // CHECK25-NEXT: store ptr @.offload_maptypes, ptr [[TMP28]], align 8
1743 // CHECK25-NEXT: [[TMP29:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
1744 // CHECK25-NEXT: store ptr null, ptr [[TMP29]], align 8
1745 // CHECK25-NEXT: [[TMP30:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
1746 // CHECK25-NEXT: store ptr null, ptr [[TMP30]], align 8
1747 // CHECK25-NEXT: [[TMP31:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
1748 // CHECK25-NEXT: store i64 [[TMP22]], ptr [[TMP31]], align 8
1749 // CHECK25-NEXT: [[TMP32:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
1750 // CHECK25-NEXT: store i64 0, ptr [[TMP32]], align 8
1751 // CHECK25-NEXT: [[TMP33:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
1752 // CHECK25-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP33]], align 4
1753 // CHECK25-NEXT: [[TMP34:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
1754 // CHECK25-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP34]], align 4
1755 // CHECK25-NEXT: [[TMP35:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
1756 // CHECK25-NEXT: store i32 0, ptr [[TMP35]], align 4
1757 // CHECK25-NEXT: [[TMP36:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB2:[0-9]+]], i64 -1, i32 0, i32 0, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l161.region_id, ptr [[KERNEL_ARGS]])
1758 // CHECK25-NEXT: [[TMP37:%.*]] = icmp ne i32 [[TMP36]], 0
1759 // CHECK25-NEXT: br i1 [[TMP37]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
1760 // CHECK25: omp_offload.failed:
1761 // CHECK25-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l161(i64 [[TMP4]], i64 [[TMP1]], ptr [[VLA]]) #[[ATTR3:[0-9]+]]
1762 // CHECK25-NEXT: br label [[OMP_OFFLOAD_CONT]]
1763 // CHECK25: omp_offload.cont:
1764 // CHECK25-NEXT: [[TMP38:%.*]] = load i32, ptr [[ARGC_ADDR]], align 4
1765 // CHECK25-NEXT: [[CALL:%.*]] = call noundef signext i32 @_Z5tmainIiLi10EEiT_(i32 noundef signext [[TMP38]])
1766 // CHECK25-NEXT: store i32 [[CALL]], ptr [[RETVAL]], align 4
1767 // CHECK25-NEXT: [[TMP39:%.*]] = load ptr, ptr [[SAVED_STACK]], align 8
1768 // CHECK25-NEXT: call void @llvm.stackrestore.p0(ptr [[TMP39]])
1769 // CHECK25-NEXT: [[TMP40:%.*]] = load i32, ptr [[RETVAL]], align 4
1770 // CHECK25-NEXT: ret i32 [[TMP40]]
1773 // CHECK25-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l161
1774 // CHECK25-SAME: (i64 noundef [[N:%.*]], i64 noundef [[VLA:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[A:%.*]]) #[[ATTR2:[0-9]+]] {
1775 // CHECK25-NEXT: entry:
1776 // CHECK25-NEXT: [[N_ADDR:%.*]] = alloca i64, align 8
1777 // CHECK25-NEXT: [[VLA_ADDR:%.*]] = alloca i64, align 8
1778 // CHECK25-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
1779 // CHECK25-NEXT: store i64 [[N]], ptr [[N_ADDR]], align 8
1780 // CHECK25-NEXT: store i64 [[VLA]], ptr [[VLA_ADDR]], align 8
1781 // CHECK25-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8
1782 // CHECK25-NEXT: [[TMP0:%.*]] = load i64, ptr [[VLA_ADDR]], align 8
1783 // CHECK25-NEXT: [[TMP1:%.*]] = load ptr, ptr [[A_ADDR]], align 8
1784 // CHECK25-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB2]], i32 3, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l161.omp_outlined, ptr [[N_ADDR]], i64 [[TMP0]], ptr [[TMP1]])
1785 // CHECK25-NEXT: ret void
1788 // CHECK25-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l161.omp_outlined
1789 // CHECK25-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[N:%.*]], i64 noundef [[VLA:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[A:%.*]]) #[[ATTR2]] {
1790 // CHECK25-NEXT: entry:
1791 // CHECK25-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
1792 // CHECK25-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
1793 // CHECK25-NEXT: [[N_ADDR:%.*]] = alloca ptr, align 8
1794 // CHECK25-NEXT: [[VLA_ADDR:%.*]] = alloca i64, align 8
1795 // CHECK25-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
1796 // CHECK25-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
1797 // CHECK25-NEXT: [[TMP:%.*]] = alloca i32, align 4
1798 // CHECK25-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
1799 // CHECK25-NEXT: [[DOTCAPTURE_EXPR_1:%.*]] = alloca i32, align 4
1800 // CHECK25-NEXT: [[I:%.*]] = alloca i32, align 4
1801 // CHECK25-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
1802 // CHECK25-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
1803 // CHECK25-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
1804 // CHECK25-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
1805 // CHECK25-NEXT: [[I3:%.*]] = alloca i32, align 4
1806 // CHECK25-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
1807 // CHECK25-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
1808 // CHECK25-NEXT: store ptr [[N]], ptr [[N_ADDR]], align 8
1809 // CHECK25-NEXT: store i64 [[VLA]], ptr [[VLA_ADDR]], align 8
1810 // CHECK25-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8
1811 // CHECK25-NEXT: [[TMP0:%.*]] = load ptr, ptr [[N_ADDR]], align 8
1812 // CHECK25-NEXT: [[TMP1:%.*]] = load i64, ptr [[VLA_ADDR]], align 8
1813 // CHECK25-NEXT: [[TMP2:%.*]] = load ptr, ptr [[A_ADDR]], align 8
1814 // CHECK25-NEXT: [[TMP3:%.*]] = load i32, ptr [[TMP0]], align 4
1815 // CHECK25-NEXT: store i32 [[TMP3]], ptr [[DOTCAPTURE_EXPR_]], align 4
1816 // CHECK25-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
1817 // CHECK25-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP4]], 0
1818 // CHECK25-NEXT: [[DIV:%.*]] = sdiv i32 [[SUB]], 1
1819 // CHECK25-NEXT: [[SUB2:%.*]] = sub nsw i32 [[DIV]], 1
1820 // CHECK25-NEXT: store i32 [[SUB2]], ptr [[DOTCAPTURE_EXPR_1]], align 4
1821 // CHECK25-NEXT: store i32 0, ptr [[I]], align 4
1822 // CHECK25-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
1823 // CHECK25-NEXT: [[CMP:%.*]] = icmp slt i32 0, [[TMP5]]
1824 // CHECK25-NEXT: br i1 [[CMP]], label [[OMP_PRECOND_THEN:%.*]], label [[OMP_PRECOND_END:%.*]]
1825 // CHECK25: omp.precond.then:
1826 // CHECK25-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
1827 // CHECK25-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
1828 // CHECK25-NEXT: store i32 [[TMP6]], ptr [[DOTOMP_COMB_UB]], align 4
1829 // CHECK25-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
1830 // CHECK25-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
1831 // CHECK25-NEXT: [[TMP7:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
1832 // CHECK25-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
1833 // CHECK25-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1:[0-9]+]], i32 [[TMP8]], i32 92, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_COMB_LB]], ptr [[DOTOMP_COMB_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
1834 // CHECK25-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1835 // CHECK25-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
1836 // CHECK25-NEXT: [[CMP4:%.*]] = icmp sgt i32 [[TMP9]], [[TMP10]]
1837 // CHECK25-NEXT: br i1 [[CMP4]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
1838 // CHECK25: cond.true:
1839 // CHECK25-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
1840 // CHECK25-NEXT: br label [[COND_END:%.*]]
1841 // CHECK25: cond.false:
1842 // CHECK25-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1843 // CHECK25-NEXT: br label [[COND_END]]
1844 // CHECK25: cond.end:
1845 // CHECK25-NEXT: [[COND:%.*]] = phi i32 [ [[TMP11]], [[COND_TRUE]] ], [ [[TMP12]], [[COND_FALSE]] ]
1846 // CHECK25-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
1847 // CHECK25-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
1848 // CHECK25-NEXT: store i32 [[TMP13]], ptr [[DOTOMP_IV]], align 4
1849 // CHECK25-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
1850 // CHECK25: omp.inner.for.cond:
1851 // CHECK25-NEXT: [[TMP14:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1852 // CHECK25-NEXT: [[TMP15:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
1853 // CHECK25-NEXT: [[CMP5:%.*]] = icmp sle i32 [[TMP14]], [[TMP15]]
1854 // CHECK25-NEXT: br i1 [[CMP5]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
1855 // CHECK25: omp.inner.for.body:
1856 // CHECK25-NEXT: [[TMP16:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1857 // CHECK25-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP16]], 1
1858 // CHECK25-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
1859 // CHECK25-NEXT: store i32 [[ADD]], ptr [[I3]], align 4
1860 // CHECK25-NEXT: [[TMP17:%.*]] = load i32, ptr [[I3]], align 4
1861 // CHECK25-NEXT: [[IDXPROM:%.*]] = sext i32 [[TMP17]] to i64
1862 // CHECK25-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[TMP2]], i64 [[IDXPROM]]
1863 // CHECK25-NEXT: store i32 0, ptr [[ARRAYIDX]], align 4
1864 // CHECK25-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
1865 // CHECK25: omp.body.continue:
1866 // CHECK25-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
1867 // CHECK25: omp.inner.for.inc:
1868 // CHECK25-NEXT: [[TMP18:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1869 // CHECK25-NEXT: [[ADD6:%.*]] = add nsw i32 [[TMP18]], 1
1870 // CHECK25-NEXT: store i32 [[ADD6]], ptr [[DOTOMP_IV]], align 4
1871 // CHECK25-NEXT: br label [[OMP_INNER_FOR_COND]]
1872 // CHECK25: omp.inner.for.end:
1873 // CHECK25-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
1874 // CHECK25: omp.loop.exit:
1875 // CHECK25-NEXT: [[TMP19:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
1876 // CHECK25-NEXT: [[TMP20:%.*]] = load i32, ptr [[TMP19]], align 4
1877 // CHECK25-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP20]])
1878 // CHECK25-NEXT: br label [[OMP_PRECOND_END]]
1879 // CHECK25: omp.precond.end:
1880 // CHECK25-NEXT: ret void
1883 // CHECK25-LABEL: define {{[^@]+}}@_Z5tmainIiLi10EEiT_
1884 // CHECK25-SAME: (i32 noundef signext [[ARGC:%.*]]) #[[ATTR5:[0-9]+]] comdat {
1885 // CHECK25-NEXT: entry:
1886 // CHECK25-NEXT: [[ARGC_ADDR:%.*]] = alloca i32, align 4
1887 // CHECK25-NEXT: [[A:%.*]] = alloca [10 x i32], align 4
1888 // CHECK25-NEXT: [[TE:%.*]] = alloca i32, align 4
1889 // CHECK25-NEXT: [[TH:%.*]] = alloca i32, align 4
1890 // CHECK25-NEXT: [[TE_CASTED:%.*]] = alloca i64, align 8
1891 // CHECK25-NEXT: [[TH_CASTED:%.*]] = alloca i64, align 8
1892 // CHECK25-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [3 x ptr], align 8
1893 // CHECK25-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [3 x ptr], align 8
1894 // CHECK25-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [3 x ptr], align 8
1895 // CHECK25-NEXT: [[TMP:%.*]] = alloca i32, align 4
1896 // CHECK25-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
1897 // CHECK25-NEXT: store i32 [[ARGC]], ptr [[ARGC_ADDR]], align 4
1898 // CHECK25-NEXT: store i32 0, ptr [[TE]], align 4
1899 // CHECK25-NEXT: store i32 128, ptr [[TH]], align 4
1900 // CHECK25-NEXT: [[TMP0:%.*]] = load i32, ptr [[TE]], align 4
1901 // CHECK25-NEXT: store i32 [[TMP0]], ptr [[TE_CASTED]], align 4
1902 // CHECK25-NEXT: [[TMP1:%.*]] = load i64, ptr [[TE_CASTED]], align 8
1903 // CHECK25-NEXT: [[TMP2:%.*]] = load i32, ptr [[TH]], align 4
1904 // CHECK25-NEXT: store i32 [[TMP2]], ptr [[TH_CASTED]], align 4
1905 // CHECK25-NEXT: [[TMP3:%.*]] = load i64, ptr [[TH_CASTED]], align 8
1906 // CHECK25-NEXT: [[TMP4:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
1907 // CHECK25-NEXT: store i64 [[TMP1]], ptr [[TMP4]], align 8
1908 // CHECK25-NEXT: [[TMP5:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
1909 // CHECK25-NEXT: store i64 [[TMP1]], ptr [[TMP5]], align 8
1910 // CHECK25-NEXT: [[TMP6:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 0
1911 // CHECK25-NEXT: store ptr null, ptr [[TMP6]], align 8
1912 // CHECK25-NEXT: [[TMP7:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 1
1913 // CHECK25-NEXT: store i64 [[TMP3]], ptr [[TMP7]], align 8
1914 // CHECK25-NEXT: [[TMP8:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 1
1915 // CHECK25-NEXT: store i64 [[TMP3]], ptr [[TMP8]], align 8
1916 // CHECK25-NEXT: [[TMP9:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 1
1917 // CHECK25-NEXT: store ptr null, ptr [[TMP9]], align 8
1918 // CHECK25-NEXT: [[TMP10:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 2
1919 // CHECK25-NEXT: store ptr [[A]], ptr [[TMP10]], align 8
1920 // CHECK25-NEXT: [[TMP11:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 2
1921 // CHECK25-NEXT: store ptr [[A]], ptr [[TMP11]], align 8
1922 // CHECK25-NEXT: [[TMP12:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 2
1923 // CHECK25-NEXT: store ptr null, ptr [[TMP12]], align 8
1924 // CHECK25-NEXT: [[TMP13:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
1925 // CHECK25-NEXT: [[TMP14:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
1926 // CHECK25-NEXT: [[TMP15:%.*]] = load i32, ptr [[TE]], align 4
1927 // CHECK25-NEXT: [[TMP16:%.*]] = load i32, ptr [[TH]], align 4
1928 // CHECK25-NEXT: [[TMP17:%.*]] = insertvalue [3 x i32] zeroinitializer, i32 [[TMP15]], 0
1929 // CHECK25-NEXT: [[TMP18:%.*]] = insertvalue [3 x i32] zeroinitializer, i32 [[TMP16]], 0
1930 // CHECK25-NEXT: [[TMP19:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
1931 // CHECK25-NEXT: store i32 3, ptr [[TMP19]], align 4
1932 // CHECK25-NEXT: [[TMP20:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
1933 // CHECK25-NEXT: store i32 3, ptr [[TMP20]], align 4
1934 // CHECK25-NEXT: [[TMP21:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
1935 // CHECK25-NEXT: store ptr [[TMP13]], ptr [[TMP21]], align 8
1936 // CHECK25-NEXT: [[TMP22:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
1937 // CHECK25-NEXT: store ptr [[TMP14]], ptr [[TMP22]], align 8
1938 // CHECK25-NEXT: [[TMP23:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
1939 // CHECK25-NEXT: store ptr @.offload_sizes.1, ptr [[TMP23]], align 8
1940 // CHECK25-NEXT: [[TMP24:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
1941 // CHECK25-NEXT: store ptr @.offload_maptypes.2, ptr [[TMP24]], align 8
1942 // CHECK25-NEXT: [[TMP25:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
1943 // CHECK25-NEXT: store ptr null, ptr [[TMP25]], align 8
1944 // CHECK25-NEXT: [[TMP26:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
1945 // CHECK25-NEXT: store ptr null, ptr [[TMP26]], align 8
1946 // CHECK25-NEXT: [[TMP27:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
1947 // CHECK25-NEXT: store i64 10, ptr [[TMP27]], align 8
1948 // CHECK25-NEXT: [[TMP28:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
1949 // CHECK25-NEXT: store i64 0, ptr [[TMP28]], align 8
1950 // CHECK25-NEXT: [[TMP29:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
1951 // CHECK25-NEXT: store [3 x i32] [[TMP17]], ptr [[TMP29]], align 4
1952 // CHECK25-NEXT: [[TMP30:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
1953 // CHECK25-NEXT: store [3 x i32] [[TMP18]], ptr [[TMP30]], align 4
1954 // CHECK25-NEXT: [[TMP31:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
1955 // CHECK25-NEXT: store i32 0, ptr [[TMP31]], align 4
1956 // CHECK25-NEXT: [[TMP32:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB2]], i64 -1, i32 [[TMP15]], i32 [[TMP16]], ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiLi10EEiT__l150.region_id, ptr [[KERNEL_ARGS]])
1957 // CHECK25-NEXT: [[TMP33:%.*]] = icmp ne i32 [[TMP32]], 0
1958 // CHECK25-NEXT: br i1 [[TMP33]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
1959 // CHECK25: omp_offload.failed:
1960 // CHECK25-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiLi10EEiT__l150(i64 [[TMP1]], i64 [[TMP3]], ptr [[A]]) #[[ATTR3]]
1961 // CHECK25-NEXT: br label [[OMP_OFFLOAD_CONT]]
1962 // CHECK25: omp_offload.cont:
1963 // CHECK25-NEXT: ret i32 0
1966 // CHECK25-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiLi10EEiT__l150
1967 // CHECK25-SAME: (i64 noundef [[TE:%.*]], i64 noundef [[TH:%.*]], ptr noundef nonnull align 4 dereferenceable(40) [[A:%.*]]) #[[ATTR2]] {
1968 // CHECK25-NEXT: entry:
1969 // CHECK25-NEXT: [[TE_ADDR:%.*]] = alloca i64, align 8
1970 // CHECK25-NEXT: [[TH_ADDR:%.*]] = alloca i64, align 8
1971 // CHECK25-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
1972 // CHECK25-NEXT: [[TMP0:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB2]])
1973 // CHECK25-NEXT: store i64 [[TE]], ptr [[TE_ADDR]], align 8
1974 // CHECK25-NEXT: store i64 [[TH]], ptr [[TH_ADDR]], align 8
1975 // CHECK25-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8
1976 // CHECK25-NEXT: [[TMP1:%.*]] = load ptr, ptr [[A_ADDR]], align 8
1977 // CHECK25-NEXT: [[TMP2:%.*]] = load i32, ptr [[TE_ADDR]], align 4
1978 // CHECK25-NEXT: [[TMP3:%.*]] = load i32, ptr [[TH_ADDR]], align 4
1979 // CHECK25-NEXT: call void @__kmpc_push_num_teams(ptr @[[GLOB2]], i32 [[TMP0]], i32 [[TMP2]], i32 [[TMP3]])
1980 // CHECK25-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB2]], i32 1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiLi10EEiT__l150.omp_outlined, ptr [[TMP1]])
1981 // CHECK25-NEXT: ret void
1984 // CHECK25-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiLi10EEiT__l150.omp_outlined
1985 // CHECK25-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(40) [[A:%.*]]) #[[ATTR2]] {
1986 // CHECK25-NEXT: entry:
1987 // CHECK25-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
1988 // CHECK25-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
1989 // CHECK25-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
1990 // CHECK25-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
1991 // CHECK25-NEXT: [[TMP:%.*]] = alloca i32, align 4
1992 // CHECK25-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
1993 // CHECK25-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
1994 // CHECK25-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
1995 // CHECK25-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
1996 // CHECK25-NEXT: [[I:%.*]] = alloca i32, align 4
1997 // CHECK25-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
1998 // CHECK25-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
1999 // CHECK25-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8
2000 // CHECK25-NEXT: [[TMP0:%.*]] = load ptr, ptr [[A_ADDR]], align 8
2001 // CHECK25-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
2002 // CHECK25-NEXT: store i32 9, ptr [[DOTOMP_COMB_UB]], align 4
2003 // CHECK25-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
2004 // CHECK25-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
2005 // CHECK25-NEXT: [[TMP1:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
2006 // CHECK25-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP1]], align 4
2007 // CHECK25-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)
2008 // CHECK25-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
2009 // CHECK25-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP3]], 9
2010 // CHECK25-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
2011 // CHECK25: cond.true:
2012 // CHECK25-NEXT: br label [[COND_END:%.*]]
2013 // CHECK25: cond.false:
2014 // CHECK25-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
2015 // CHECK25-NEXT: br label [[COND_END]]
2016 // CHECK25: cond.end:
2017 // CHECK25-NEXT: [[COND:%.*]] = phi i32 [ 9, [[COND_TRUE]] ], [ [[TMP4]], [[COND_FALSE]] ]
2018 // CHECK25-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
2019 // CHECK25-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
2020 // CHECK25-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_IV]], align 4
2021 // CHECK25-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
2022 // CHECK25: omp.inner.for.cond:
2023 // CHECK25-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
2024 // CHECK25-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
2025 // CHECK25-NEXT: [[CMP1:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
2026 // CHECK25-NEXT: br i1 [[CMP1]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
2027 // CHECK25: omp.inner.for.body:
2028 // CHECK25-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
2029 // CHECK25-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP8]], 1
2030 // CHECK25-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
2031 // CHECK25-NEXT: store i32 [[ADD]], ptr [[I]], align 4
2032 // CHECK25-NEXT: [[TMP9:%.*]] = load i32, ptr [[I]], align 4
2033 // CHECK25-NEXT: [[IDXPROM:%.*]] = sext i32 [[TMP9]] to i64
2034 // CHECK25-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [10 x i32], ptr [[TMP0]], i64 0, i64 [[IDXPROM]]
2035 // CHECK25-NEXT: store i32 0, ptr [[ARRAYIDX]], align 4
2036 // CHECK25-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
2037 // CHECK25: omp.body.continue:
2038 // CHECK25-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
2039 // CHECK25: omp.inner.for.inc:
2040 // CHECK25-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
2041 // CHECK25-NEXT: [[ADD2:%.*]] = add nsw i32 [[TMP10]], 1
2042 // CHECK25-NEXT: store i32 [[ADD2]], ptr [[DOTOMP_IV]], align 4
2043 // CHECK25-NEXT: br label [[OMP_INNER_FOR_COND]]
2044 // CHECK25: omp.inner.for.end:
2045 // CHECK25-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
2046 // CHECK25: omp.loop.exit:
2047 // CHECK25-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP2]])
2048 // CHECK25-NEXT: ret void
2051 // CHECK27-LABEL: define {{[^@]+}}@main
2052 // CHECK27-SAME: (i32 noundef [[ARGC:%.*]], ptr noundef [[ARGV:%.*]]) #[[ATTR0:[0-9]+]] {
2053 // CHECK27-NEXT: entry:
2054 // CHECK27-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
2055 // CHECK27-NEXT: [[ARGC_ADDR:%.*]] = alloca i32, align 4
2056 // CHECK27-NEXT: [[ARGV_ADDR:%.*]] = alloca ptr, align 4
2057 // CHECK27-NEXT: [[N:%.*]] = alloca i32, align 4
2058 // CHECK27-NEXT: [[SAVED_STACK:%.*]] = alloca ptr, align 4
2059 // CHECK27-NEXT: [[__VLA_EXPR0:%.*]] = alloca i32, align 4
2060 // CHECK27-NEXT: [[N_CASTED:%.*]] = alloca i32, align 4
2061 // CHECK27-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [3 x ptr], align 4
2062 // CHECK27-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [3 x ptr], align 4
2063 // CHECK27-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [3 x ptr], align 4
2064 // CHECK27-NEXT: [[DOTOFFLOAD_SIZES:%.*]] = alloca [3 x i64], align 4
2065 // CHECK27-NEXT: [[TMP:%.*]] = alloca i32, align 4
2066 // CHECK27-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
2067 // CHECK27-NEXT: [[DOTCAPTURE_EXPR_1:%.*]] = alloca i32, align 4
2068 // CHECK27-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
2069 // CHECK27-NEXT: store i32 0, ptr [[RETVAL]], align 4
2070 // CHECK27-NEXT: store i32 [[ARGC]], ptr [[ARGC_ADDR]], align 4
2071 // CHECK27-NEXT: store ptr [[ARGV]], ptr [[ARGV_ADDR]], align 4
2072 // CHECK27-NEXT: store i32 100, ptr [[N]], align 4
2073 // CHECK27-NEXT: [[TMP0:%.*]] = load i32, ptr [[N]], align 4
2074 // CHECK27-NEXT: [[TMP1:%.*]] = call ptr @llvm.stacksave.p0()
2075 // CHECK27-NEXT: store ptr [[TMP1]], ptr [[SAVED_STACK]], align 4
2076 // CHECK27-NEXT: [[VLA:%.*]] = alloca i32, i32 [[TMP0]], align 4
2077 // CHECK27-NEXT: store i32 [[TMP0]], ptr [[__VLA_EXPR0]], align 4
2078 // CHECK27-NEXT: [[TMP2:%.*]] = load i32, ptr [[N]], align 4
2079 // CHECK27-NEXT: store i32 [[TMP2]], ptr [[N_CASTED]], align 4
2080 // CHECK27-NEXT: [[TMP3:%.*]] = load i32, ptr [[N_CASTED]], align 4
2081 // CHECK27-NEXT: [[TMP4:%.*]] = mul nuw i32 [[TMP0]], 4
2082 // CHECK27-NEXT: [[TMP5:%.*]] = sext i32 [[TMP4]] to i64
2083 // CHECK27-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 4 [[DOTOFFLOAD_SIZES]], ptr align 4 @.offload_sizes, i32 24, i1 false)
2084 // CHECK27-NEXT: [[TMP6:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
2085 // CHECK27-NEXT: store i32 [[TMP3]], ptr [[TMP6]], align 4
2086 // CHECK27-NEXT: [[TMP7:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
2087 // CHECK27-NEXT: store i32 [[TMP3]], ptr [[TMP7]], align 4
2088 // CHECK27-NEXT: [[TMP8:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i32 0, i32 0
2089 // CHECK27-NEXT: store ptr null, ptr [[TMP8]], align 4
2090 // CHECK27-NEXT: [[TMP9:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 1
2091 // CHECK27-NEXT: store i32 [[TMP0]], ptr [[TMP9]], align 4
2092 // CHECK27-NEXT: [[TMP10:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 1
2093 // CHECK27-NEXT: store i32 [[TMP0]], ptr [[TMP10]], align 4
2094 // CHECK27-NEXT: [[TMP11:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i32 0, i32 1
2095 // CHECK27-NEXT: store ptr null, ptr [[TMP11]], align 4
2096 // CHECK27-NEXT: [[TMP12:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 2
2097 // CHECK27-NEXT: store ptr [[VLA]], ptr [[TMP12]], align 4
2098 // CHECK27-NEXT: [[TMP13:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 2
2099 // CHECK27-NEXT: store ptr [[VLA]], ptr [[TMP13]], align 4
2100 // CHECK27-NEXT: [[TMP14:%.*]] = getelementptr inbounds [3 x i64], ptr [[DOTOFFLOAD_SIZES]], i32 0, i32 2
2101 // CHECK27-NEXT: store i64 [[TMP5]], ptr [[TMP14]], align 4
2102 // CHECK27-NEXT: [[TMP15:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i32 0, i32 2
2103 // CHECK27-NEXT: store ptr null, ptr [[TMP15]], align 4
2104 // CHECK27-NEXT: [[TMP16:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
2105 // CHECK27-NEXT: [[TMP17:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
2106 // CHECK27-NEXT: [[TMP18:%.*]] = getelementptr inbounds [3 x i64], ptr [[DOTOFFLOAD_SIZES]], i32 0, i32 0
2107 // CHECK27-NEXT: [[TMP19:%.*]] = load i32, ptr [[N]], align 4
2108 // CHECK27-NEXT: store i32 [[TMP19]], ptr [[DOTCAPTURE_EXPR_]], align 4
2109 // CHECK27-NEXT: [[TMP20:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
2110 // CHECK27-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP20]], 0
2111 // CHECK27-NEXT: [[DIV:%.*]] = sdiv i32 [[SUB]], 1
2112 // CHECK27-NEXT: [[SUB2:%.*]] = sub nsw i32 [[DIV]], 1
2113 // CHECK27-NEXT: store i32 [[SUB2]], ptr [[DOTCAPTURE_EXPR_1]], align 4
2114 // CHECK27-NEXT: [[TMP21:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
2115 // CHECK27-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP21]], 1
2116 // CHECK27-NEXT: [[TMP22:%.*]] = zext i32 [[ADD]] to i64
2117 // CHECK27-NEXT: [[TMP23:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
2118 // CHECK27-NEXT: store i32 3, ptr [[TMP23]], align 4
2119 // CHECK27-NEXT: [[TMP24:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
2120 // CHECK27-NEXT: store i32 3, ptr [[TMP24]], align 4
2121 // CHECK27-NEXT: [[TMP25:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
2122 // CHECK27-NEXT: store ptr [[TMP16]], ptr [[TMP25]], align 4
2123 // CHECK27-NEXT: [[TMP26:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
2124 // CHECK27-NEXT: store ptr [[TMP17]], ptr [[TMP26]], align 4
2125 // CHECK27-NEXT: [[TMP27:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
2126 // CHECK27-NEXT: store ptr [[TMP18]], ptr [[TMP27]], align 4
2127 // CHECK27-NEXT: [[TMP28:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
2128 // CHECK27-NEXT: store ptr @.offload_maptypes, ptr [[TMP28]], align 4
2129 // CHECK27-NEXT: [[TMP29:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
2130 // CHECK27-NEXT: store ptr null, ptr [[TMP29]], align 4
2131 // CHECK27-NEXT: [[TMP30:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
2132 // CHECK27-NEXT: store ptr null, ptr [[TMP30]], align 4
2133 // CHECK27-NEXT: [[TMP31:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
2134 // CHECK27-NEXT: store i64 [[TMP22]], ptr [[TMP31]], align 8
2135 // CHECK27-NEXT: [[TMP32:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
2136 // CHECK27-NEXT: store i64 0, ptr [[TMP32]], align 8
2137 // CHECK27-NEXT: [[TMP33:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
2138 // CHECK27-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP33]], align 4
2139 // CHECK27-NEXT: [[TMP34:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
2140 // CHECK27-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP34]], align 4
2141 // CHECK27-NEXT: [[TMP35:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
2142 // CHECK27-NEXT: store i32 0, ptr [[TMP35]], align 4
2143 // CHECK27-NEXT: [[TMP36:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB2:[0-9]+]], i64 -1, i32 0, i32 0, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l161.region_id, ptr [[KERNEL_ARGS]])
2144 // CHECK27-NEXT: [[TMP37:%.*]] = icmp ne i32 [[TMP36]], 0
2145 // CHECK27-NEXT: br i1 [[TMP37]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
2146 // CHECK27: omp_offload.failed:
2147 // CHECK27-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l161(i32 [[TMP3]], i32 [[TMP0]], ptr [[VLA]]) #[[ATTR3:[0-9]+]]
2148 // CHECK27-NEXT: br label [[OMP_OFFLOAD_CONT]]
2149 // CHECK27: omp_offload.cont:
2150 // CHECK27-NEXT: [[TMP38:%.*]] = load i32, ptr [[ARGC_ADDR]], align 4
2151 // CHECK27-NEXT: [[CALL:%.*]] = call noundef i32 @_Z5tmainIiLi10EEiT_(i32 noundef [[TMP38]])
2152 // CHECK27-NEXT: store i32 [[CALL]], ptr [[RETVAL]], align 4
2153 // CHECK27-NEXT: [[TMP39:%.*]] = load ptr, ptr [[SAVED_STACK]], align 4
2154 // CHECK27-NEXT: call void @llvm.stackrestore.p0(ptr [[TMP39]])
2155 // CHECK27-NEXT: [[TMP40:%.*]] = load i32, ptr [[RETVAL]], align 4
2156 // CHECK27-NEXT: ret i32 [[TMP40]]
2159 // CHECK27-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l161
2160 // CHECK27-SAME: (i32 noundef [[N:%.*]], i32 noundef [[VLA:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[A:%.*]]) #[[ATTR2:[0-9]+]] {
2161 // CHECK27-NEXT: entry:
2162 // CHECK27-NEXT: [[N_ADDR:%.*]] = alloca i32, align 4
2163 // CHECK27-NEXT: [[VLA_ADDR:%.*]] = alloca i32, align 4
2164 // CHECK27-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 4
2165 // CHECK27-NEXT: store i32 [[N]], ptr [[N_ADDR]], align 4
2166 // CHECK27-NEXT: store i32 [[VLA]], ptr [[VLA_ADDR]], align 4
2167 // CHECK27-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 4
2168 // CHECK27-NEXT: [[TMP0:%.*]] = load i32, ptr [[VLA_ADDR]], align 4
2169 // CHECK27-NEXT: [[TMP1:%.*]] = load ptr, ptr [[A_ADDR]], align 4
2170 // CHECK27-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB2]], i32 3, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l161.omp_outlined, ptr [[N_ADDR]], i32 [[TMP0]], ptr [[TMP1]])
2171 // CHECK27-NEXT: ret void
2174 // CHECK27-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l161.omp_outlined
2175 // CHECK27-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[N:%.*]], i32 noundef [[VLA:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[A:%.*]]) #[[ATTR2]] {
2176 // CHECK27-NEXT: entry:
2177 // CHECK27-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 4
2178 // CHECK27-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 4
2179 // CHECK27-NEXT: [[N_ADDR:%.*]] = alloca ptr, align 4
2180 // CHECK27-NEXT: [[VLA_ADDR:%.*]] = alloca i32, align 4
2181 // CHECK27-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 4
2182 // CHECK27-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
2183 // CHECK27-NEXT: [[TMP:%.*]] = alloca i32, align 4
2184 // CHECK27-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
2185 // CHECK27-NEXT: [[DOTCAPTURE_EXPR_1:%.*]] = alloca i32, align 4
2186 // CHECK27-NEXT: [[I:%.*]] = alloca i32, align 4
2187 // CHECK27-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
2188 // CHECK27-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
2189 // CHECK27-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
2190 // CHECK27-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
2191 // CHECK27-NEXT: [[I3:%.*]] = alloca i32, align 4
2192 // CHECK27-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 4
2193 // CHECK27-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 4
2194 // CHECK27-NEXT: store ptr [[N]], ptr [[N_ADDR]], align 4
2195 // CHECK27-NEXT: store i32 [[VLA]], ptr [[VLA_ADDR]], align 4
2196 // CHECK27-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 4
2197 // CHECK27-NEXT: [[TMP0:%.*]] = load ptr, ptr [[N_ADDR]], align 4
2198 // CHECK27-NEXT: [[TMP1:%.*]] = load i32, ptr [[VLA_ADDR]], align 4
2199 // CHECK27-NEXT: [[TMP2:%.*]] = load ptr, ptr [[A_ADDR]], align 4
2200 // CHECK27-NEXT: [[TMP3:%.*]] = load i32, ptr [[TMP0]], align 4
2201 // CHECK27-NEXT: store i32 [[TMP3]], ptr [[DOTCAPTURE_EXPR_]], align 4
2202 // CHECK27-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
2203 // CHECK27-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP4]], 0
2204 // CHECK27-NEXT: [[DIV:%.*]] = sdiv i32 [[SUB]], 1
2205 // CHECK27-NEXT: [[SUB2:%.*]] = sub nsw i32 [[DIV]], 1
2206 // CHECK27-NEXT: store i32 [[SUB2]], ptr [[DOTCAPTURE_EXPR_1]], align 4
2207 // CHECK27-NEXT: store i32 0, ptr [[I]], align 4
2208 // CHECK27-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
2209 // CHECK27-NEXT: [[CMP:%.*]] = icmp slt i32 0, [[TMP5]]
2210 // CHECK27-NEXT: br i1 [[CMP]], label [[OMP_PRECOND_THEN:%.*]], label [[OMP_PRECOND_END:%.*]]
2211 // CHECK27: omp.precond.then:
2212 // CHECK27-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
2213 // CHECK27-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
2214 // CHECK27-NEXT: store i32 [[TMP6]], ptr [[DOTOMP_COMB_UB]], align 4
2215 // CHECK27-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
2216 // CHECK27-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
2217 // CHECK27-NEXT: [[TMP7:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 4
2218 // CHECK27-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
2219 // CHECK27-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1:[0-9]+]], i32 [[TMP8]], i32 92, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_COMB_LB]], ptr [[DOTOMP_COMB_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
2220 // CHECK27-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
2221 // CHECK27-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
2222 // CHECK27-NEXT: [[CMP4:%.*]] = icmp sgt i32 [[TMP9]], [[TMP10]]
2223 // CHECK27-NEXT: br i1 [[CMP4]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
2224 // CHECK27: cond.true:
2225 // CHECK27-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
2226 // CHECK27-NEXT: br label [[COND_END:%.*]]
2227 // CHECK27: cond.false:
2228 // CHECK27-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
2229 // CHECK27-NEXT: br label [[COND_END]]
2230 // CHECK27: cond.end:
2231 // CHECK27-NEXT: [[COND:%.*]] = phi i32 [ [[TMP11]], [[COND_TRUE]] ], [ [[TMP12]], [[COND_FALSE]] ]
2232 // CHECK27-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
2233 // CHECK27-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
2234 // CHECK27-NEXT: store i32 [[TMP13]], ptr [[DOTOMP_IV]], align 4
2235 // CHECK27-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
2236 // CHECK27: omp.inner.for.cond:
2237 // CHECK27-NEXT: [[TMP14:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
2238 // CHECK27-NEXT: [[TMP15:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
2239 // CHECK27-NEXT: [[CMP5:%.*]] = icmp sle i32 [[TMP14]], [[TMP15]]
2240 // CHECK27-NEXT: br i1 [[CMP5]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
2241 // CHECK27: omp.inner.for.body:
2242 // CHECK27-NEXT: [[TMP16:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
2243 // CHECK27-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP16]], 1
2244 // CHECK27-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
2245 // CHECK27-NEXT: store i32 [[ADD]], ptr [[I3]], align 4
2246 // CHECK27-NEXT: [[TMP17:%.*]] = load i32, ptr [[I3]], align 4
2247 // CHECK27-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[TMP2]], i32 [[TMP17]]
2248 // CHECK27-NEXT: store i32 0, ptr [[ARRAYIDX]], align 4
2249 // CHECK27-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
2250 // CHECK27: omp.body.continue:
2251 // CHECK27-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
2252 // CHECK27: omp.inner.for.inc:
2253 // CHECK27-NEXT: [[TMP18:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
2254 // CHECK27-NEXT: [[ADD6:%.*]] = add nsw i32 [[TMP18]], 1
2255 // CHECK27-NEXT: store i32 [[ADD6]], ptr [[DOTOMP_IV]], align 4
2256 // CHECK27-NEXT: br label [[OMP_INNER_FOR_COND]]
2257 // CHECK27: omp.inner.for.end:
2258 // CHECK27-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
2259 // CHECK27: omp.loop.exit:
2260 // CHECK27-NEXT: [[TMP19:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 4
2261 // CHECK27-NEXT: [[TMP20:%.*]] = load i32, ptr [[TMP19]], align 4
2262 // CHECK27-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP20]])
2263 // CHECK27-NEXT: br label [[OMP_PRECOND_END]]
2264 // CHECK27: omp.precond.end:
2265 // CHECK27-NEXT: ret void
2268 // CHECK27-LABEL: define {{[^@]+}}@_Z5tmainIiLi10EEiT_
2269 // CHECK27-SAME: (i32 noundef [[ARGC:%.*]]) #[[ATTR5:[0-9]+]] comdat {
2270 // CHECK27-NEXT: entry:
2271 // CHECK27-NEXT: [[ARGC_ADDR:%.*]] = alloca i32, align 4
2272 // CHECK27-NEXT: [[A:%.*]] = alloca [10 x i32], align 4
2273 // CHECK27-NEXT: [[TE:%.*]] = alloca i32, align 4
2274 // CHECK27-NEXT: [[TH:%.*]] = alloca i32, align 4
2275 // CHECK27-NEXT: [[TE_CASTED:%.*]] = alloca i32, align 4
2276 // CHECK27-NEXT: [[TH_CASTED:%.*]] = alloca i32, align 4
2277 // CHECK27-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [3 x ptr], align 4
2278 // CHECK27-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [3 x ptr], align 4
2279 // CHECK27-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [3 x ptr], align 4
2280 // CHECK27-NEXT: [[TMP:%.*]] = alloca i32, align 4
2281 // CHECK27-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
2282 // CHECK27-NEXT: store i32 [[ARGC]], ptr [[ARGC_ADDR]], align 4
2283 // CHECK27-NEXT: store i32 0, ptr [[TE]], align 4
2284 // CHECK27-NEXT: store i32 128, ptr [[TH]], align 4
2285 // CHECK27-NEXT: [[TMP0:%.*]] = load i32, ptr [[TE]], align 4
2286 // CHECK27-NEXT: store i32 [[TMP0]], ptr [[TE_CASTED]], align 4
2287 // CHECK27-NEXT: [[TMP1:%.*]] = load i32, ptr [[TE_CASTED]], align 4
2288 // CHECK27-NEXT: [[TMP2:%.*]] = load i32, ptr [[TH]], align 4
2289 // CHECK27-NEXT: store i32 [[TMP2]], ptr [[TH_CASTED]], align 4
2290 // CHECK27-NEXT: [[TMP3:%.*]] = load i32, ptr [[TH_CASTED]], align 4
2291 // CHECK27-NEXT: [[TMP4:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
2292 // CHECK27-NEXT: store i32 [[TMP1]], ptr [[TMP4]], align 4
2293 // CHECK27-NEXT: [[TMP5:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
2294 // CHECK27-NEXT: store i32 [[TMP1]], ptr [[TMP5]], align 4
2295 // CHECK27-NEXT: [[TMP6:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i32 0, i32 0
2296 // CHECK27-NEXT: store ptr null, ptr [[TMP6]], align 4
2297 // CHECK27-NEXT: [[TMP7:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 1
2298 // CHECK27-NEXT: store i32 [[TMP3]], ptr [[TMP7]], align 4
2299 // CHECK27-NEXT: [[TMP8:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 1
2300 // CHECK27-NEXT: store i32 [[TMP3]], ptr [[TMP8]], align 4
2301 // CHECK27-NEXT: [[TMP9:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i32 0, i32 1
2302 // CHECK27-NEXT: store ptr null, ptr [[TMP9]], align 4
2303 // CHECK27-NEXT: [[TMP10:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 2
2304 // CHECK27-NEXT: store ptr [[A]], ptr [[TMP10]], align 4
2305 // CHECK27-NEXT: [[TMP11:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 2
2306 // CHECK27-NEXT: store ptr [[A]], ptr [[TMP11]], align 4
2307 // CHECK27-NEXT: [[TMP12:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i32 0, i32 2
2308 // CHECK27-NEXT: store ptr null, ptr [[TMP12]], align 4
2309 // CHECK27-NEXT: [[TMP13:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
2310 // CHECK27-NEXT: [[TMP14:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
2311 // CHECK27-NEXT: [[TMP15:%.*]] = load i32, ptr [[TE]], align 4
2312 // CHECK27-NEXT: [[TMP16:%.*]] = load i32, ptr [[TH]], align 4
2313 // CHECK27-NEXT: [[TMP17:%.*]] = insertvalue [3 x i32] zeroinitializer, i32 [[TMP15]], 0
2314 // CHECK27-NEXT: [[TMP18:%.*]] = insertvalue [3 x i32] zeroinitializer, i32 [[TMP16]], 0
2315 // CHECK27-NEXT: [[TMP19:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
2316 // CHECK27-NEXT: store i32 3, ptr [[TMP19]], align 4
2317 // CHECK27-NEXT: [[TMP20:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
2318 // CHECK27-NEXT: store i32 3, ptr [[TMP20]], align 4
2319 // CHECK27-NEXT: [[TMP21:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
2320 // CHECK27-NEXT: store ptr [[TMP13]], ptr [[TMP21]], align 4
2321 // CHECK27-NEXT: [[TMP22:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
2322 // CHECK27-NEXT: store ptr [[TMP14]], ptr [[TMP22]], align 4
2323 // CHECK27-NEXT: [[TMP23:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
2324 // CHECK27-NEXT: store ptr @.offload_sizes.1, ptr [[TMP23]], align 4
2325 // CHECK27-NEXT: [[TMP24:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
2326 // CHECK27-NEXT: store ptr @.offload_maptypes.2, ptr [[TMP24]], align 4
2327 // CHECK27-NEXT: [[TMP25:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
2328 // CHECK27-NEXT: store ptr null, ptr [[TMP25]], align 4
2329 // CHECK27-NEXT: [[TMP26:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
2330 // CHECK27-NEXT: store ptr null, ptr [[TMP26]], align 4
2331 // CHECK27-NEXT: [[TMP27:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
2332 // CHECK27-NEXT: store i64 10, ptr [[TMP27]], align 8
2333 // CHECK27-NEXT: [[TMP28:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
2334 // CHECK27-NEXT: store i64 0, ptr [[TMP28]], align 8
2335 // CHECK27-NEXT: [[TMP29:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
2336 // CHECK27-NEXT: store [3 x i32] [[TMP17]], ptr [[TMP29]], align 4
2337 // CHECK27-NEXT: [[TMP30:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
2338 // CHECK27-NEXT: store [3 x i32] [[TMP18]], ptr [[TMP30]], align 4
2339 // CHECK27-NEXT: [[TMP31:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
2340 // CHECK27-NEXT: store i32 0, ptr [[TMP31]], align 4
2341 // CHECK27-NEXT: [[TMP32:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB2]], i64 -1, i32 [[TMP15]], i32 [[TMP16]], ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiLi10EEiT__l150.region_id, ptr [[KERNEL_ARGS]])
2342 // CHECK27-NEXT: [[TMP33:%.*]] = icmp ne i32 [[TMP32]], 0
2343 // CHECK27-NEXT: br i1 [[TMP33]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
2344 // CHECK27: omp_offload.failed:
2345 // CHECK27-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiLi10EEiT__l150(i32 [[TMP1]], i32 [[TMP3]], ptr [[A]]) #[[ATTR3]]
2346 // CHECK27-NEXT: br label [[OMP_OFFLOAD_CONT]]
2347 // CHECK27: omp_offload.cont:
2348 // CHECK27-NEXT: ret i32 0
2351 // CHECK27-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiLi10EEiT__l150
2352 // CHECK27-SAME: (i32 noundef [[TE:%.*]], i32 noundef [[TH:%.*]], ptr noundef nonnull align 4 dereferenceable(40) [[A:%.*]]) #[[ATTR2]] {
2353 // CHECK27-NEXT: entry:
2354 // CHECK27-NEXT: [[TE_ADDR:%.*]] = alloca i32, align 4
2355 // CHECK27-NEXT: [[TH_ADDR:%.*]] = alloca i32, align 4
2356 // CHECK27-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 4
2357 // CHECK27-NEXT: [[TMP0:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB2]])
2358 // CHECK27-NEXT: store i32 [[TE]], ptr [[TE_ADDR]], align 4
2359 // CHECK27-NEXT: store i32 [[TH]], ptr [[TH_ADDR]], align 4
2360 // CHECK27-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 4
2361 // CHECK27-NEXT: [[TMP1:%.*]] = load ptr, ptr [[A_ADDR]], align 4
2362 // CHECK27-NEXT: [[TMP2:%.*]] = load i32, ptr [[TE_ADDR]], align 4
2363 // CHECK27-NEXT: [[TMP3:%.*]] = load i32, ptr [[TH_ADDR]], align 4
2364 // CHECK27-NEXT: call void @__kmpc_push_num_teams(ptr @[[GLOB2]], i32 [[TMP0]], i32 [[TMP2]], i32 [[TMP3]])
2365 // CHECK27-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB2]], i32 1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiLi10EEiT__l150.omp_outlined, ptr [[TMP1]])
2366 // CHECK27-NEXT: ret void
2369 // CHECK27-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiLi10EEiT__l150.omp_outlined
2370 // CHECK27-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(40) [[A:%.*]]) #[[ATTR2]] {
2371 // CHECK27-NEXT: entry:
2372 // CHECK27-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 4
2373 // CHECK27-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 4
2374 // CHECK27-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 4
2375 // CHECK27-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
2376 // CHECK27-NEXT: [[TMP:%.*]] = alloca i32, align 4
2377 // CHECK27-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
2378 // CHECK27-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
2379 // CHECK27-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
2380 // CHECK27-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
2381 // CHECK27-NEXT: [[I:%.*]] = alloca i32, align 4
2382 // CHECK27-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 4
2383 // CHECK27-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 4
2384 // CHECK27-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 4
2385 // CHECK27-NEXT: [[TMP0:%.*]] = load ptr, ptr [[A_ADDR]], align 4
2386 // CHECK27-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
2387 // CHECK27-NEXT: store i32 9, ptr [[DOTOMP_COMB_UB]], align 4
2388 // CHECK27-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
2389 // CHECK27-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
2390 // CHECK27-NEXT: [[TMP1:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 4
2391 // CHECK27-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP1]], align 4
2392 // CHECK27-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)
2393 // CHECK27-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
2394 // CHECK27-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP3]], 9
2395 // CHECK27-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
2396 // CHECK27: cond.true:
2397 // CHECK27-NEXT: br label [[COND_END:%.*]]
2398 // CHECK27: cond.false:
2399 // CHECK27-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
2400 // CHECK27-NEXT: br label [[COND_END]]
2401 // CHECK27: cond.end:
2402 // CHECK27-NEXT: [[COND:%.*]] = phi i32 [ 9, [[COND_TRUE]] ], [ [[TMP4]], [[COND_FALSE]] ]
2403 // CHECK27-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
2404 // CHECK27-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
2405 // CHECK27-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_IV]], align 4
2406 // CHECK27-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
2407 // CHECK27: omp.inner.for.cond:
2408 // CHECK27-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
2409 // CHECK27-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
2410 // CHECK27-NEXT: [[CMP1:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
2411 // CHECK27-NEXT: br i1 [[CMP1]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
2412 // CHECK27: omp.inner.for.body:
2413 // CHECK27-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
2414 // CHECK27-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP8]], 1
2415 // CHECK27-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
2416 // CHECK27-NEXT: store i32 [[ADD]], ptr [[I]], align 4
2417 // CHECK27-NEXT: [[TMP9:%.*]] = load i32, ptr [[I]], align 4
2418 // CHECK27-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [10 x i32], ptr [[TMP0]], i32 0, i32 [[TMP9]]
2419 // CHECK27-NEXT: store i32 0, ptr [[ARRAYIDX]], align 4
2420 // CHECK27-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
2421 // CHECK27: omp.body.continue:
2422 // CHECK27-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
2423 // CHECK27: omp.inner.for.inc:
2424 // CHECK27-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
2425 // CHECK27-NEXT: [[ADD2:%.*]] = add nsw i32 [[TMP10]], 1
2426 // CHECK27-NEXT: store i32 [[ADD2]], ptr [[DOTOMP_IV]], align 4
2427 // CHECK27-NEXT: br label [[OMP_INNER_FOR_COND]]
2428 // CHECK27: omp.inner.for.end:
2429 // CHECK27-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
2430 // CHECK27: omp.loop.exit:
2431 // CHECK27-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP2]])
2432 // CHECK27-NEXT: ret void