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