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
25 #pragma omp target parallel map(tofrom: aa) num_threads(1024)
30 #pragma omp target parallel map(tofrom:a, aa, b) if(target: n>40) num_threads(n)
43 a
+= ftemplate
<int>(n
);
49 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l25
50 // CHECK1-SAME: (ptr noalias noundef [[DYN_PTR:%.*]], ptr noundef nonnull align 2 dereferenceable(2) [[AA:%.*]]) #[[ATTR0:[0-9]+]] {
51 // CHECK1-NEXT: entry:
52 // CHECK1-NEXT: [[DYN_PTR_ADDR:%.*]] = alloca ptr, align 8
53 // CHECK1-NEXT: [[AA_ADDR:%.*]] = alloca ptr, align 8
54 // CHECK1-NEXT: [[CAPTURED_VARS_ADDRS:%.*]] = alloca [1 x ptr], align 8
55 // CHECK1-NEXT: store ptr [[DYN_PTR]], ptr [[DYN_PTR_ADDR]], align 8
56 // CHECK1-NEXT: store ptr [[AA]], ptr [[AA_ADDR]], align 8
57 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[AA_ADDR]], align 8
58 // CHECK1-NEXT: [[TMP1:%.*]] = call i32 @__kmpc_target_init(ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l25_kernel_environment, ptr [[DYN_PTR]])
59 // CHECK1-NEXT: [[EXEC_USER_CODE:%.*]] = icmp eq i32 [[TMP1]], -1
60 // CHECK1-NEXT: br i1 [[EXEC_USER_CODE]], label [[USER_CODE_ENTRY:%.*]], label [[WORKER_EXIT:%.*]]
61 // CHECK1: user_code.entry:
62 // CHECK1-NEXT: [[TMP2:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1:[0-9]+]])
63 // CHECK1-NEXT: [[TMP3:%.*]] = getelementptr inbounds [1 x ptr], ptr [[CAPTURED_VARS_ADDRS]], i64 0, i64 0
64 // CHECK1-NEXT: store ptr [[TMP0]], ptr [[TMP3]], align 8
65 // CHECK1-NEXT: call void @__kmpc_parallel_51(ptr @[[GLOB1]], i32 [[TMP2]], i32 1, i32 1024, i32 -1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l25_omp_outlined, ptr null, ptr [[CAPTURED_VARS_ADDRS]], i64 1)
66 // CHECK1-NEXT: call void @__kmpc_target_deinit()
67 // CHECK1-NEXT: ret void
68 // CHECK1: worker.exit:
69 // CHECK1-NEXT: ret void
72 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l25_omp_outlined
73 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 2 dereferenceable(2) [[AA:%.*]]) #[[ATTR1:[0-9]+]] {
74 // CHECK1-NEXT: entry:
75 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
76 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
77 // CHECK1-NEXT: [[AA_ADDR:%.*]] = alloca ptr, align 8
78 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
79 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
80 // CHECK1-NEXT: store ptr [[AA]], ptr [[AA_ADDR]], align 8
81 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[AA_ADDR]], align 8
82 // CHECK1-NEXT: [[TMP1:%.*]] = load i16, ptr [[TMP0]], align 2
83 // CHECK1-NEXT: [[CONV:%.*]] = sext i16 [[TMP1]] to i32
84 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[CONV]], 1
85 // CHECK1-NEXT: [[CONV1:%.*]] = trunc i32 [[ADD]] to i16
86 // CHECK1-NEXT: store i16 [[CONV1]], ptr [[TMP0]], align 2
87 // CHECK1-NEXT: ret void
90 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l30
91 // 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:%.*]], i64 noundef [[DOTCAPTURE_EXPR_:%.*]]) #[[ATTR4:[0-9]+]] {
92 // CHECK1-NEXT: entry:
93 // CHECK1-NEXT: [[DYN_PTR_ADDR:%.*]] = alloca ptr, align 8
94 // CHECK1-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
95 // CHECK1-NEXT: [[AA_ADDR:%.*]] = alloca ptr, align 8
96 // CHECK1-NEXT: [[B_ADDR:%.*]] = alloca ptr, align 8
97 // CHECK1-NEXT: [[DOTCAPTURE_EXPR__ADDR:%.*]] = alloca i64, align 8
98 // CHECK1-NEXT: [[CAPTURED_VARS_ADDRS:%.*]] = alloca [3 x ptr], align 8
99 // CHECK1-NEXT: store ptr [[DYN_PTR]], ptr [[DYN_PTR_ADDR]], align 8
100 // CHECK1-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8
101 // CHECK1-NEXT: store ptr [[AA]], ptr [[AA_ADDR]], align 8
102 // CHECK1-NEXT: store ptr [[B]], ptr [[B_ADDR]], align 8
103 // CHECK1-NEXT: store i64 [[DOTCAPTURE_EXPR_]], ptr [[DOTCAPTURE_EXPR__ADDR]], align 8
104 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[A_ADDR]], align 8
105 // CHECK1-NEXT: [[TMP1:%.*]] = load ptr, ptr [[AA_ADDR]], align 8
106 // CHECK1-NEXT: [[TMP2:%.*]] = load ptr, ptr [[B_ADDR]], align 8
107 // CHECK1-NEXT: [[TMP3:%.*]] = call i32 @__kmpc_target_init(ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l30_kernel_environment, ptr [[DYN_PTR]])
108 // CHECK1-NEXT: [[EXEC_USER_CODE:%.*]] = icmp eq i32 [[TMP3]], -1
109 // CHECK1-NEXT: br i1 [[EXEC_USER_CODE]], label [[USER_CODE_ENTRY:%.*]], label [[WORKER_EXIT:%.*]]
110 // CHECK1: user_code.entry:
111 // CHECK1-NEXT: [[TMP4:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1]])
112 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR__ADDR]], align 4
113 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds [3 x ptr], ptr [[CAPTURED_VARS_ADDRS]], i64 0, i64 0
114 // CHECK1-NEXT: store ptr [[TMP0]], ptr [[TMP6]], align 8
115 // CHECK1-NEXT: [[TMP7:%.*]] = getelementptr inbounds [3 x ptr], ptr [[CAPTURED_VARS_ADDRS]], i64 0, i64 1
116 // CHECK1-NEXT: store ptr [[TMP1]], ptr [[TMP7]], align 8
117 // CHECK1-NEXT: [[TMP8:%.*]] = getelementptr inbounds [3 x ptr], ptr [[CAPTURED_VARS_ADDRS]], i64 0, i64 2
118 // CHECK1-NEXT: store ptr [[TMP2]], ptr [[TMP8]], align 8
119 // CHECK1-NEXT: call void @__kmpc_parallel_51(ptr @[[GLOB1]], i32 [[TMP4]], i32 1, i32 [[TMP5]], i32 -1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l30_omp_outlined, ptr null, ptr [[CAPTURED_VARS_ADDRS]], i64 3)
120 // CHECK1-NEXT: call void @__kmpc_target_deinit()
121 // CHECK1-NEXT: ret void
122 // CHECK1: worker.exit:
123 // CHECK1-NEXT: ret void
126 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l30_omp_outlined
127 // 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]] {
128 // CHECK1-NEXT: entry:
129 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
130 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
131 // CHECK1-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
132 // CHECK1-NEXT: [[AA_ADDR:%.*]] = alloca ptr, align 8
133 // CHECK1-NEXT: [[B_ADDR:%.*]] = alloca ptr, align 8
134 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
135 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
136 // CHECK1-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8
137 // CHECK1-NEXT: store ptr [[AA]], ptr [[AA_ADDR]], align 8
138 // CHECK1-NEXT: store ptr [[B]], ptr [[B_ADDR]], align 8
139 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[A_ADDR]], align 8
140 // CHECK1-NEXT: [[TMP1:%.*]] = load ptr, ptr [[AA_ADDR]], align 8
141 // CHECK1-NEXT: [[TMP2:%.*]] = load ptr, ptr [[B_ADDR]], align 8
142 // CHECK1-NEXT: [[TMP3:%.*]] = load i32, ptr [[TMP0]], align 4
143 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP3]], 1
144 // CHECK1-NEXT: store i32 [[ADD]], ptr [[TMP0]], align 4
145 // CHECK1-NEXT: [[TMP4:%.*]] = load i16, ptr [[TMP1]], align 2
146 // CHECK1-NEXT: [[CONV:%.*]] = sext i16 [[TMP4]] to i32
147 // CHECK1-NEXT: [[ADD1:%.*]] = add nsw i32 [[CONV]], 1
148 // CHECK1-NEXT: [[CONV2:%.*]] = trunc i32 [[ADD1]] to i16
149 // CHECK1-NEXT: store i16 [[CONV2]], ptr [[TMP1]], align 2
150 // CHECK1-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [10 x i32], ptr [[TMP2]], i64 0, i64 2
151 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[ARRAYIDX]], align 4
152 // CHECK1-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP5]], 1
153 // CHECK1-NEXT: store i32 [[ADD3]], ptr [[ARRAYIDX]], align 4
154 // CHECK1-NEXT: ret void
157 // CHECK2-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l25
158 // CHECK2-SAME: (ptr noalias noundef [[DYN_PTR:%.*]], ptr noundef nonnull align 2 dereferenceable(2) [[AA:%.*]]) #[[ATTR0:[0-9]+]] {
159 // CHECK2-NEXT: entry:
160 // CHECK2-NEXT: [[DYN_PTR_ADDR:%.*]] = alloca ptr, align 4
161 // CHECK2-NEXT: [[AA_ADDR:%.*]] = alloca ptr, align 4
162 // CHECK2-NEXT: [[CAPTURED_VARS_ADDRS:%.*]] = alloca [1 x ptr], align 4
163 // CHECK2-NEXT: store ptr [[DYN_PTR]], ptr [[DYN_PTR_ADDR]], align 4
164 // CHECK2-NEXT: store ptr [[AA]], ptr [[AA_ADDR]], align 4
165 // CHECK2-NEXT: [[TMP0:%.*]] = load ptr, ptr [[AA_ADDR]], align 4
166 // CHECK2-NEXT: [[TMP1:%.*]] = call i32 @__kmpc_target_init(ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l25_kernel_environment, ptr [[DYN_PTR]])
167 // CHECK2-NEXT: [[EXEC_USER_CODE:%.*]] = icmp eq i32 [[TMP1]], -1
168 // CHECK2-NEXT: br i1 [[EXEC_USER_CODE]], label [[USER_CODE_ENTRY:%.*]], label [[WORKER_EXIT:%.*]]
169 // CHECK2: user_code.entry:
170 // CHECK2-NEXT: [[TMP2:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1:[0-9]+]])
171 // CHECK2-NEXT: [[TMP3:%.*]] = getelementptr inbounds [1 x ptr], ptr [[CAPTURED_VARS_ADDRS]], i32 0, i32 0
172 // CHECK2-NEXT: store ptr [[TMP0]], ptr [[TMP3]], align 4
173 // CHECK2-NEXT: call void @__kmpc_parallel_51(ptr @[[GLOB1]], i32 [[TMP2]], i32 1, i32 1024, i32 -1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l25_omp_outlined, ptr null, ptr [[CAPTURED_VARS_ADDRS]], i32 1)
174 // CHECK2-NEXT: call void @__kmpc_target_deinit()
175 // CHECK2-NEXT: ret void
176 // CHECK2: worker.exit:
177 // CHECK2-NEXT: ret void
180 // CHECK2-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l25_omp_outlined
181 // CHECK2-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 2 dereferenceable(2) [[AA:%.*]]) #[[ATTR1:[0-9]+]] {
182 // CHECK2-NEXT: entry:
183 // CHECK2-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 4
184 // CHECK2-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 4
185 // CHECK2-NEXT: [[AA_ADDR:%.*]] = alloca ptr, align 4
186 // CHECK2-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 4
187 // CHECK2-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 4
188 // CHECK2-NEXT: store ptr [[AA]], ptr [[AA_ADDR]], align 4
189 // CHECK2-NEXT: [[TMP0:%.*]] = load ptr, ptr [[AA_ADDR]], align 4
190 // CHECK2-NEXT: [[TMP1:%.*]] = load i16, ptr [[TMP0]], align 2
191 // CHECK2-NEXT: [[CONV:%.*]] = sext i16 [[TMP1]] to i32
192 // CHECK2-NEXT: [[ADD:%.*]] = add nsw i32 [[CONV]], 1
193 // CHECK2-NEXT: [[CONV1:%.*]] = trunc i32 [[ADD]] to i16
194 // CHECK2-NEXT: store i16 [[CONV1]], ptr [[TMP0]], align 2
195 // CHECK2-NEXT: ret void
198 // CHECK2-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l30
199 // 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:%.*]], i32 noundef [[DOTCAPTURE_EXPR_:%.*]]) #[[ATTR4:[0-9]+]] {
200 // CHECK2-NEXT: entry:
201 // CHECK2-NEXT: [[DYN_PTR_ADDR:%.*]] = alloca ptr, align 4
202 // CHECK2-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 4
203 // CHECK2-NEXT: [[AA_ADDR:%.*]] = alloca ptr, align 4
204 // CHECK2-NEXT: [[B_ADDR:%.*]] = alloca ptr, align 4
205 // CHECK2-NEXT: [[DOTCAPTURE_EXPR__ADDR:%.*]] = alloca i32, align 4
206 // CHECK2-NEXT: [[CAPTURED_VARS_ADDRS:%.*]] = alloca [3 x ptr], align 4
207 // CHECK2-NEXT: store ptr [[DYN_PTR]], ptr [[DYN_PTR_ADDR]], align 4
208 // CHECK2-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 4
209 // CHECK2-NEXT: store ptr [[AA]], ptr [[AA_ADDR]], align 4
210 // CHECK2-NEXT: store ptr [[B]], ptr [[B_ADDR]], align 4
211 // CHECK2-NEXT: store i32 [[DOTCAPTURE_EXPR_]], ptr [[DOTCAPTURE_EXPR__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_l30_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:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR__ADDR]], align 4
221 // CHECK2-NEXT: [[TMP6:%.*]] = getelementptr inbounds [3 x ptr], ptr [[CAPTURED_VARS_ADDRS]], i32 0, i32 0
222 // CHECK2-NEXT: store ptr [[TMP0]], ptr [[TMP6]], align 4
223 // CHECK2-NEXT: [[TMP7:%.*]] = getelementptr inbounds [3 x ptr], ptr [[CAPTURED_VARS_ADDRS]], i32 0, i32 1
224 // CHECK2-NEXT: store ptr [[TMP1]], ptr [[TMP7]], align 4
225 // CHECK2-NEXT: [[TMP8:%.*]] = getelementptr inbounds [3 x ptr], ptr [[CAPTURED_VARS_ADDRS]], i32 0, i32 2
226 // CHECK2-NEXT: store ptr [[TMP2]], ptr [[TMP8]], align 4
227 // CHECK2-NEXT: call void @__kmpc_parallel_51(ptr @[[GLOB1]], i32 [[TMP4]], i32 1, i32 [[TMP5]], i32 -1, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l30_omp_outlined, ptr null, ptr [[CAPTURED_VARS_ADDRS]], i32 3)
228 // CHECK2-NEXT: call void @__kmpc_target_deinit()
229 // CHECK2-NEXT: ret void
230 // CHECK2: worker.exit:
231 // CHECK2-NEXT: ret void
234 // CHECK2-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z9ftemplateIiET_i_l30_omp_outlined
235 // 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]] {
236 // CHECK2-NEXT: entry:
237 // CHECK2-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 4
238 // CHECK2-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 4
239 // CHECK2-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 4
240 // CHECK2-NEXT: [[AA_ADDR:%.*]] = alloca ptr, align 4
241 // CHECK2-NEXT: [[B_ADDR:%.*]] = alloca ptr, align 4
242 // CHECK2-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 4
243 // CHECK2-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 4
244 // CHECK2-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 4
245 // CHECK2-NEXT: store ptr [[AA]], ptr [[AA_ADDR]], align 4
246 // CHECK2-NEXT: store ptr [[B]], ptr [[B_ADDR]], align 4
247 // CHECK2-NEXT: [[TMP0:%.*]] = load ptr, ptr [[A_ADDR]], align 4
248 // CHECK2-NEXT: [[TMP1:%.*]] = load ptr, ptr [[AA_ADDR]], align 4
249 // CHECK2-NEXT: [[TMP2:%.*]] = load ptr, ptr [[B_ADDR]], align 4
250 // CHECK2-NEXT: [[TMP3:%.*]] = load i32, ptr [[TMP0]], align 4
251 // CHECK2-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP3]], 1
252 // CHECK2-NEXT: store i32 [[ADD]], ptr [[TMP0]], align 4
253 // CHECK2-NEXT: [[TMP4:%.*]] = load i16, ptr [[TMP1]], align 2
254 // CHECK2-NEXT: [[CONV:%.*]] = sext i16 [[TMP4]] to i32
255 // CHECK2-NEXT: [[ADD1:%.*]] = add nsw i32 [[CONV]], 1
256 // CHECK2-NEXT: [[CONV2:%.*]] = trunc i32 [[ADD1]] to i16
257 // CHECK2-NEXT: store i16 [[CONV2]], ptr [[TMP1]], align 2
258 // CHECK2-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [10 x i32], ptr [[TMP2]], i32 0, i32 2
259 // CHECK2-NEXT: [[TMP5:%.*]] = load i32, ptr [[ARRAYIDX]], align 4
260 // CHECK2-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP5]], 1
261 // CHECK2-NEXT: store i32 [[ADD3]], ptr [[ARRAYIDX]], align 4
262 // CHECK2-NEXT: ret void