[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / nvptx_target_parallel_codegen.cpp
blob35f8089662bd582598fa437926a86f0b67306e73
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 // Test target codegen - host bc file has to be created first.
3 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
4 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - -disable-llvm-optzns | FileCheck %s --check-prefix=CHECK1
5 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -x c++ -triple i386-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm-bc %s -o %t-x86-host.bc
6 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - -disable-llvm-optzns | FileCheck %s --check-prefix=CHECK2
7 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-cuda-mode -fexceptions -fcxx-exceptions -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - -disable-llvm-optzns | FileCheck %s --check-prefix=CHECK2
9 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-cuda-mode -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
10 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-cuda-mode -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - -disable-llvm-optzns | FileCheck %s --check-prefix=CHECK1
11 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-cuda-mode -x c++ -triple i386-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm-bc %s -o %t-x86-host.bc
12 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-cuda-mode -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - -disable-llvm-optzns | FileCheck %s --check-prefix=CHECK2
13 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-cuda-mode -fexceptions -fcxx-exceptions -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - -disable-llvm-optzns | FileCheck %s --check-prefix=CHECK2
15 // expected-no-diagnostics
16 #ifndef HEADER
17 #define HEADER
19 template<typename tx>
20 tx ftemplate(int n) {
21 tx a = 0;
22 short aa = 0;
23 tx b[10];
25 #pragma omp target parallel if(target: 0)
27 a += 1;
30 #pragma omp target parallel map(tofrom: aa)
32 aa += 1;
35 #pragma omp target parallel map(tofrom:a, aa, b) if(target: n>40)
37 a += 1;
38 aa += 1;
39 b[2] += 1;
42 return a;
45 int bar(int n){
46 int a = 0;
48 a += ftemplate<int>(n);
50 return a;
53 #endif
54 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l30
55 // CHECK1-SAME: (ptr noalias noundef [[DYN_PTR:%.*]], ptr noundef nonnull align 2 dereferenceable(2) [[AA:%.*]]) #[[ATTR0:[0-9]+]] {
56 // CHECK1-NEXT: entry:
57 // CHECK1-NEXT: [[DYN_PTR_ADDR:%.*]] = alloca ptr, align 8
58 // CHECK1-NEXT: [[AA_ADDR:%.*]] = alloca ptr, align 8
59 // CHECK1-NEXT: [[CAPTURED_VARS_ADDRS:%.*]] = alloca [1 x ptr], align 8
60 // CHECK1-NEXT: store ptr [[DYN_PTR]], ptr [[DYN_PTR_ADDR]], align 8
61 // CHECK1-NEXT: store ptr [[AA]], ptr [[AA_ADDR]], align 8
62 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[AA_ADDR]], align 8
63 // CHECK1-NEXT: [[TMP1:%.*]] = call i32 @__kmpc_target_init(ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l30_kernel_environment, ptr [[DYN_PTR]])
64 // CHECK1-NEXT: [[EXEC_USER_CODE:%.*]] = icmp eq i32 [[TMP1]], -1
65 // CHECK1-NEXT: br i1 [[EXEC_USER_CODE]], label [[USER_CODE_ENTRY:%.*]], label [[WORKER_EXIT:%.*]]
66 // CHECK1: user_code.entry:
67 // CHECK1-NEXT: [[TMP2:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1:[0-9]+]])
68 // CHECK1-NEXT: [[TMP3:%.*]] = getelementptr inbounds [1 x ptr], ptr [[CAPTURED_VARS_ADDRS]], i64 0, i64 0
69 // CHECK1-NEXT: store ptr [[TMP0]], ptr [[TMP3]], align 8
70 // CHECK1-NEXT: call void @__kmpc_parallel_51(ptr @[[GLOB1]], i32 [[TMP2]], i32 1, i32 -1, i32 -1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l30_omp_outlined, ptr null, ptr [[CAPTURED_VARS_ADDRS]], i64 1)
71 // CHECK1-NEXT: call void @__kmpc_target_deinit()
72 // CHECK1-NEXT: ret void
73 // CHECK1: worker.exit:
74 // CHECK1-NEXT: ret void
77 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l30_omp_outlined
78 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 2 dereferenceable(2) [[AA:%.*]]) #[[ATTR1:[0-9]+]] {
79 // CHECK1-NEXT: entry:
80 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
81 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
82 // CHECK1-NEXT: [[AA_ADDR:%.*]] = alloca ptr, align 8
83 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
84 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
85 // CHECK1-NEXT: store ptr [[AA]], ptr [[AA_ADDR]], align 8
86 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[AA_ADDR]], align 8
87 // CHECK1-NEXT: [[TMP1:%.*]] = load i16, ptr [[TMP0]], align 2
88 // CHECK1-NEXT: [[CONV:%.*]] = sext i16 [[TMP1]] to i32
89 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[CONV]], 1
90 // CHECK1-NEXT: [[CONV1:%.*]] = trunc i32 [[ADD]] to i16
91 // CHECK1-NEXT: store i16 [[CONV1]], ptr [[TMP0]], align 2
92 // CHECK1-NEXT: ret void
95 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l35
96 // CHECK1-SAME: (ptr noalias noundef [[DYN_PTR:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[A:%.*]], ptr noundef nonnull align 2 dereferenceable(2) [[AA:%.*]], ptr noundef nonnull align 4 dereferenceable(40) [[B:%.*]]) #[[ATTR0]] {
97 // CHECK1-NEXT: entry:
98 // CHECK1-NEXT: [[DYN_PTR_ADDR:%.*]] = alloca ptr, align 8
99 // CHECK1-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
100 // CHECK1-NEXT: [[AA_ADDR:%.*]] = alloca ptr, align 8
101 // CHECK1-NEXT: [[B_ADDR:%.*]] = alloca ptr, align 8
102 // CHECK1-NEXT: [[CAPTURED_VARS_ADDRS:%.*]] = alloca [3 x ptr], align 8
103 // CHECK1-NEXT: store ptr [[DYN_PTR]], ptr [[DYN_PTR_ADDR]], align 8
104 // CHECK1-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8
105 // CHECK1-NEXT: store ptr [[AA]], ptr [[AA_ADDR]], align 8
106 // CHECK1-NEXT: store ptr [[B]], ptr [[B_ADDR]], align 8
107 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[A_ADDR]], align 8
108 // CHECK1-NEXT: [[TMP1:%.*]] = load ptr, ptr [[AA_ADDR]], align 8
109 // CHECK1-NEXT: [[TMP2:%.*]] = load ptr, ptr [[B_ADDR]], align 8
110 // CHECK1-NEXT: [[TMP3:%.*]] = call i32 @__kmpc_target_init(ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l35_kernel_environment, ptr [[DYN_PTR]])
111 // CHECK1-NEXT: [[EXEC_USER_CODE:%.*]] = icmp eq i32 [[TMP3]], -1
112 // CHECK1-NEXT: br i1 [[EXEC_USER_CODE]], label [[USER_CODE_ENTRY:%.*]], label [[WORKER_EXIT:%.*]]
113 // CHECK1: user_code.entry:
114 // CHECK1-NEXT: [[TMP4:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1]])
115 // CHECK1-NEXT: [[TMP5:%.*]] = getelementptr inbounds [3 x ptr], ptr [[CAPTURED_VARS_ADDRS]], i64 0, i64 0
116 // CHECK1-NEXT: store ptr [[TMP0]], ptr [[TMP5]], align 8
117 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds [3 x ptr], ptr [[CAPTURED_VARS_ADDRS]], i64 0, i64 1
118 // CHECK1-NEXT: store ptr [[TMP1]], ptr [[TMP6]], align 8
119 // CHECK1-NEXT: [[TMP7:%.*]] = getelementptr inbounds [3 x ptr], ptr [[CAPTURED_VARS_ADDRS]], i64 0, i64 2
120 // CHECK1-NEXT: store ptr [[TMP2]], ptr [[TMP7]], align 8
121 // CHECK1-NEXT: call void @__kmpc_parallel_51(ptr @[[GLOB1]], i32 [[TMP4]], i32 1, i32 -1, i32 -1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l35_omp_outlined, ptr null, ptr [[CAPTURED_VARS_ADDRS]], i64 3)
122 // CHECK1-NEXT: call void @__kmpc_target_deinit()
123 // CHECK1-NEXT: ret void
124 // CHECK1: worker.exit:
125 // CHECK1-NEXT: ret void
128 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l35_omp_outlined
129 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[A:%.*]], ptr noundef nonnull align 2 dereferenceable(2) [[AA:%.*]], ptr noundef nonnull align 4 dereferenceable(40) [[B:%.*]]) #[[ATTR1]] {
130 // CHECK1-NEXT: entry:
131 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
132 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
133 // CHECK1-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
134 // CHECK1-NEXT: [[AA_ADDR:%.*]] = alloca ptr, align 8
135 // CHECK1-NEXT: [[B_ADDR:%.*]] = alloca ptr, align 8
136 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
137 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
138 // CHECK1-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8
139 // CHECK1-NEXT: store ptr [[AA]], ptr [[AA_ADDR]], align 8
140 // CHECK1-NEXT: store ptr [[B]], ptr [[B_ADDR]], align 8
141 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[A_ADDR]], align 8
142 // CHECK1-NEXT: [[TMP1:%.*]] = load ptr, ptr [[AA_ADDR]], align 8
143 // CHECK1-NEXT: [[TMP2:%.*]] = load ptr, ptr [[B_ADDR]], align 8
144 // CHECK1-NEXT: [[TMP3:%.*]] = load i32, ptr [[TMP0]], align 4
145 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP3]], 1
146 // CHECK1-NEXT: store i32 [[ADD]], ptr [[TMP0]], align 4
147 // CHECK1-NEXT: [[TMP4:%.*]] = load i16, ptr [[TMP1]], align 2
148 // CHECK1-NEXT: [[CONV:%.*]] = sext i16 [[TMP4]] to i32
149 // CHECK1-NEXT: [[ADD1:%.*]] = add nsw i32 [[CONV]], 1
150 // CHECK1-NEXT: [[CONV2:%.*]] = trunc i32 [[ADD1]] to i16
151 // CHECK1-NEXT: store i16 [[CONV2]], ptr [[TMP1]], align 2
152 // CHECK1-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [10 x i32], ptr [[TMP2]], i64 0, i64 2
153 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[ARRAYIDX]], align 4
154 // CHECK1-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP5]], 1
155 // CHECK1-NEXT: store i32 [[ADD3]], ptr [[ARRAYIDX]], align 4
156 // CHECK1-NEXT: ret void
159 // CHECK2-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l30
160 // CHECK2-SAME: (ptr noalias noundef [[DYN_PTR:%.*]], ptr noundef nonnull align 2 dereferenceable(2) [[AA:%.*]]) #[[ATTR0:[0-9]+]] {
161 // CHECK2-NEXT: entry:
162 // CHECK2-NEXT: [[DYN_PTR_ADDR:%.*]] = alloca ptr, align 4
163 // CHECK2-NEXT: [[AA_ADDR:%.*]] = alloca ptr, align 4
164 // CHECK2-NEXT: [[CAPTURED_VARS_ADDRS:%.*]] = alloca [1 x ptr], align 4
165 // CHECK2-NEXT: store ptr [[DYN_PTR]], ptr [[DYN_PTR_ADDR]], align 4
166 // CHECK2-NEXT: store ptr [[AA]], ptr [[AA_ADDR]], align 4
167 // CHECK2-NEXT: [[TMP0:%.*]] = load ptr, ptr [[AA_ADDR]], align 4
168 // CHECK2-NEXT: [[TMP1:%.*]] = call i32 @__kmpc_target_init(ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l30_kernel_environment, ptr [[DYN_PTR]])
169 // CHECK2-NEXT: [[EXEC_USER_CODE:%.*]] = icmp eq i32 [[TMP1]], -1
170 // CHECK2-NEXT: br i1 [[EXEC_USER_CODE]], label [[USER_CODE_ENTRY:%.*]], label [[WORKER_EXIT:%.*]]
171 // CHECK2: user_code.entry:
172 // CHECK2-NEXT: [[TMP2:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1:[0-9]+]])
173 // CHECK2-NEXT: [[TMP3:%.*]] = getelementptr inbounds [1 x ptr], ptr [[CAPTURED_VARS_ADDRS]], i32 0, i32 0
174 // CHECK2-NEXT: store ptr [[TMP0]], ptr [[TMP3]], align 4
175 // CHECK2-NEXT: call void @__kmpc_parallel_51(ptr @[[GLOB1]], i32 [[TMP2]], i32 1, i32 -1, i32 -1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l30_omp_outlined, ptr null, ptr [[CAPTURED_VARS_ADDRS]], i32 1)
176 // CHECK2-NEXT: call void @__kmpc_target_deinit()
177 // CHECK2-NEXT: ret void
178 // CHECK2: worker.exit:
179 // CHECK2-NEXT: ret void
182 // CHECK2-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l30_omp_outlined
183 // CHECK2-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 2 dereferenceable(2) [[AA:%.*]]) #[[ATTR1:[0-9]+]] {
184 // CHECK2-NEXT: entry:
185 // CHECK2-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 4
186 // CHECK2-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 4
187 // CHECK2-NEXT: [[AA_ADDR:%.*]] = alloca ptr, align 4
188 // CHECK2-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 4
189 // CHECK2-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 4
190 // CHECK2-NEXT: store ptr [[AA]], ptr [[AA_ADDR]], align 4
191 // CHECK2-NEXT: [[TMP0:%.*]] = load ptr, ptr [[AA_ADDR]], align 4
192 // CHECK2-NEXT: [[TMP1:%.*]] = load i16, ptr [[TMP0]], align 2
193 // CHECK2-NEXT: [[CONV:%.*]] = sext i16 [[TMP1]] to i32
194 // CHECK2-NEXT: [[ADD:%.*]] = add nsw i32 [[CONV]], 1
195 // CHECK2-NEXT: [[CONV1:%.*]] = trunc i32 [[ADD]] to i16
196 // CHECK2-NEXT: store i16 [[CONV1]], ptr [[TMP0]], align 2
197 // CHECK2-NEXT: ret void
200 // CHECK2-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l35
201 // CHECK2-SAME: (ptr noalias noundef [[DYN_PTR:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[A:%.*]], ptr noundef nonnull align 2 dereferenceable(2) [[AA:%.*]], ptr noundef nonnull align 4 dereferenceable(40) [[B:%.*]]) #[[ATTR0]] {
202 // CHECK2-NEXT: entry:
203 // CHECK2-NEXT: [[DYN_PTR_ADDR:%.*]] = alloca ptr, align 4
204 // CHECK2-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 4
205 // CHECK2-NEXT: [[AA_ADDR:%.*]] = alloca ptr, align 4
206 // CHECK2-NEXT: [[B_ADDR:%.*]] = alloca ptr, align 4
207 // CHECK2-NEXT: [[CAPTURED_VARS_ADDRS:%.*]] = alloca [3 x ptr], align 4
208 // CHECK2-NEXT: store ptr [[DYN_PTR]], ptr [[DYN_PTR_ADDR]], align 4
209 // CHECK2-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 4
210 // CHECK2-NEXT: store ptr [[AA]], ptr [[AA_ADDR]], align 4
211 // CHECK2-NEXT: store ptr [[B]], ptr [[B_ADDR]], align 4
212 // CHECK2-NEXT: [[TMP0:%.*]] = load ptr, ptr [[A_ADDR]], align 4
213 // CHECK2-NEXT: [[TMP1:%.*]] = load ptr, ptr [[AA_ADDR]], align 4
214 // CHECK2-NEXT: [[TMP2:%.*]] = load ptr, ptr [[B_ADDR]], align 4
215 // CHECK2-NEXT: [[TMP3:%.*]] = call i32 @__kmpc_target_init(ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l35_kernel_environment, ptr [[DYN_PTR]])
216 // CHECK2-NEXT: [[EXEC_USER_CODE:%.*]] = icmp eq i32 [[TMP3]], -1
217 // CHECK2-NEXT: br i1 [[EXEC_USER_CODE]], label [[USER_CODE_ENTRY:%.*]], label [[WORKER_EXIT:%.*]]
218 // CHECK2: user_code.entry:
219 // CHECK2-NEXT: [[TMP4:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1]])
220 // CHECK2-NEXT: [[TMP5:%.*]] = getelementptr inbounds [3 x ptr], ptr [[CAPTURED_VARS_ADDRS]], i32 0, i32 0
221 // CHECK2-NEXT: store ptr [[TMP0]], ptr [[TMP5]], align 4
222 // CHECK2-NEXT: [[TMP6:%.*]] = getelementptr inbounds [3 x ptr], ptr [[CAPTURED_VARS_ADDRS]], i32 0, i32 1
223 // CHECK2-NEXT: store ptr [[TMP1]], ptr [[TMP6]], align 4
224 // CHECK2-NEXT: [[TMP7:%.*]] = getelementptr inbounds [3 x ptr], ptr [[CAPTURED_VARS_ADDRS]], i32 0, i32 2
225 // CHECK2-NEXT: store ptr [[TMP2]], ptr [[TMP7]], align 4
226 // CHECK2-NEXT: call void @__kmpc_parallel_51(ptr @[[GLOB1]], i32 [[TMP4]], i32 1, i32 -1, i32 -1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l35_omp_outlined, ptr null, ptr [[CAPTURED_VARS_ADDRS]], i32 3)
227 // CHECK2-NEXT: call void @__kmpc_target_deinit()
228 // CHECK2-NEXT: ret void
229 // CHECK2: worker.exit:
230 // CHECK2-NEXT: ret void
233 // CHECK2-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l35_omp_outlined
234 // CHECK2-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[A:%.*]], ptr noundef nonnull align 2 dereferenceable(2) [[AA:%.*]], ptr noundef nonnull align 4 dereferenceable(40) [[B:%.*]]) #[[ATTR1]] {
235 // CHECK2-NEXT: entry:
236 // CHECK2-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 4
237 // CHECK2-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 4
238 // CHECK2-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 4
239 // CHECK2-NEXT: [[AA_ADDR:%.*]] = alloca ptr, align 4
240 // CHECK2-NEXT: [[B_ADDR:%.*]] = alloca ptr, align 4
241 // CHECK2-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 4
242 // CHECK2-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 4
243 // CHECK2-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 4
244 // CHECK2-NEXT: store ptr [[AA]], ptr [[AA_ADDR]], align 4
245 // CHECK2-NEXT: store ptr [[B]], ptr [[B_ADDR]], align 4
246 // CHECK2-NEXT: [[TMP0:%.*]] = load ptr, ptr [[A_ADDR]], align 4
247 // CHECK2-NEXT: [[TMP1:%.*]] = load ptr, ptr [[AA_ADDR]], align 4
248 // CHECK2-NEXT: [[TMP2:%.*]] = load ptr, ptr [[B_ADDR]], align 4
249 // CHECK2-NEXT: [[TMP3:%.*]] = load i32, ptr [[TMP0]], align 4
250 // CHECK2-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP3]], 1
251 // CHECK2-NEXT: store i32 [[ADD]], ptr [[TMP0]], align 4
252 // CHECK2-NEXT: [[TMP4:%.*]] = load i16, ptr [[TMP1]], align 2
253 // CHECK2-NEXT: [[CONV:%.*]] = sext i16 [[TMP4]] to i32
254 // CHECK2-NEXT: [[ADD1:%.*]] = add nsw i32 [[CONV]], 1
255 // CHECK2-NEXT: [[CONV2:%.*]] = trunc i32 [[ADD1]] to i16
256 // CHECK2-NEXT: store i16 [[CONV2]], ptr [[TMP1]], align 2
257 // CHECK2-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [10 x i32], ptr [[TMP2]], i32 0, i32 2
258 // CHECK2-NEXT: [[TMP5:%.*]] = load i32, ptr [[ARRAYIDX]], align 4
259 // CHECK2-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP5]], 1
260 // CHECK2-NEXT: store i32 [[ADD3]], ptr [[ARRAYIDX]], align 4
261 // CHECK2-NEXT: ret void