Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / cancellation_point_codegen.cpp
blob85c7585b357c949158a38a40f84ed36ba589b2bc
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --function-signature --include-generated-funcs --replace-value-regex "__omp_offloading_[0-9a-z]+_[0-9a-z]+" "reduction_size[.].+[.]" "pl_cond[.].+[.|,]" --prefix-filecheck-ir-name _
2 // RUN: %clang_cc1 -verify -fopenmp -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK1
3 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t %s
4 // RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefix=CHECK1
6 // RUN: %clang_cc1 -verify -fopenmp-simd -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
7 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t %s
8 // RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
9 // expected-no-diagnostics
10 #ifndef HEADER
11 #define HEADER
13 int main (int argc, char **argv) {
14 #pragma omp parallel
16 #pragma omp cancellation point parallel
17 #pragma omp cancel parallel
18 argv[0][0] = argc;
20 #pragma omp sections
23 #pragma omp cancellation point sections
24 #pragma omp cancel sections
27 #pragma omp sections
29 #pragma omp cancellation point sections
30 #pragma omp section
32 #pragma omp cancellation point sections
33 #pragma omp cancel sections
36 #pragma omp for
37 for (int i = 0; i < argc; ++i) {
38 #pragma omp cancellation point for
39 #pragma omp cancel for
41 #pragma omp task
43 #pragma omp cancellation point taskgroup
44 #pragma omp cancel taskgroup
46 #pragma omp task
48 #pragma omp cancellation point taskgroup
50 #pragma omp parallel sections
53 #pragma omp cancellation point sections
54 #pragma omp cancel sections
57 #pragma omp parallel sections
60 #pragma omp cancellation point sections
61 #pragma omp cancel sections
63 #pragma omp section
65 #pragma omp cancellation point sections
68 #pragma omp parallel for
69 for (int i = 0; i < argc; ++i) {
70 #pragma omp cancellation point for
71 #pragma omp cancel for
73 return argc;
82 #endif
83 // CHECK1-LABEL: define {{[^@]+}}@main
84 // CHECK1-SAME: (i32 noundef [[ARGC:%.*]], ptr noundef [[ARGV:%.*]]) #[[ATTR0:[0-9]+]] {
85 // CHECK1-NEXT: entry:
86 // CHECK1-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
87 // CHECK1-NEXT: [[ARGC_ADDR:%.*]] = alloca i32, align 4
88 // CHECK1-NEXT: [[ARGV_ADDR:%.*]] = alloca ptr, align 8
89 // CHECK1-NEXT: [[DOTOMP_SECTIONS_LB_:%.*]] = alloca i32, align 4
90 // CHECK1-NEXT: [[DOTOMP_SECTIONS_UB_:%.*]] = alloca i32, align 4
91 // CHECK1-NEXT: [[DOTOMP_SECTIONS_ST_:%.*]] = alloca i32, align 4
92 // CHECK1-NEXT: [[DOTOMP_SECTIONS_IL_:%.*]] = alloca i32, align 4
93 // CHECK1-NEXT: [[DOTOMP_SECTIONS_IV_:%.*]] = alloca i32, align 4
94 // CHECK1-NEXT: [[DOTOMP_SECTIONS_LB_3:%.*]] = alloca i32, align 4
95 // CHECK1-NEXT: [[DOTOMP_SECTIONS_UB_4:%.*]] = alloca i32, align 4
96 // CHECK1-NEXT: [[DOTOMP_SECTIONS_ST_5:%.*]] = alloca i32, align 4
97 // CHECK1-NEXT: [[DOTOMP_SECTIONS_IL_6:%.*]] = alloca i32, align 4
98 // CHECK1-NEXT: [[DOTOMP_SECTIONS_IV_7:%.*]] = alloca i32, align 4
99 // CHECK1-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
100 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
101 // CHECK1-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
102 // CHECK1-NEXT: [[DOTCAPTURE_EXPR_25:%.*]] = alloca i32, align 4
103 // CHECK1-NEXT: [[I:%.*]] = alloca i32, align 4
104 // CHECK1-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
105 // CHECK1-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
106 // CHECK1-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
107 // CHECK1-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
108 // CHECK1-NEXT: [[I28:%.*]] = alloca i32, align 4
109 // CHECK1-NEXT: [[AGG_CAPTURED:%.*]] = alloca [[STRUCT_ANON:%.*]], align 1
110 // CHECK1-NEXT: [[AGG_CAPTURED42:%.*]] = alloca [[STRUCT_ANON_0:%.*]], align 1
111 // CHECK1-NEXT: [[TMP0:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1:[0-9]+]])
112 // CHECK1-NEXT: store i32 0, ptr [[RETVAL]], align 4
113 // CHECK1-NEXT: store i32 [[ARGC]], ptr [[ARGC_ADDR]], align 4
114 // CHECK1-NEXT: store ptr [[ARGV]], ptr [[ARGV_ADDR]], align 8
115 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB1]], i32 2, ptr @main.omp_outlined, ptr [[ARGV_ADDR]], ptr [[ARGC_ADDR]])
116 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_LB_]], align 4
117 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_UB_]], align 4
118 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_SECTIONS_ST_]], align 4
119 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_IL_]], align 4
120 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB3:[0-9]+]], i32 [[TMP0]], i32 34, ptr [[DOTOMP_SECTIONS_IL_]], ptr [[DOTOMP_SECTIONS_LB_]], ptr [[DOTOMP_SECTIONS_UB_]], ptr [[DOTOMP_SECTIONS_ST_]], i32 1, i32 1)
121 // CHECK1-NEXT: [[TMP1:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_]], align 4
122 // CHECK1-NEXT: [[TMP2:%.*]] = icmp slt i32 [[TMP1]], 0
123 // CHECK1-NEXT: [[TMP3:%.*]] = select i1 [[TMP2]], i32 [[TMP1]], i32 0
124 // CHECK1-NEXT: store i32 [[TMP3]], ptr [[DOTOMP_SECTIONS_UB_]], align 4
125 // CHECK1-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_LB_]], align 4
126 // CHECK1-NEXT: store i32 [[TMP4]], ptr [[DOTOMP_SECTIONS_IV_]], align 4
127 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
128 // CHECK1: omp.inner.for.cond:
129 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
130 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_]], align 4
131 // CHECK1-NEXT: [[CMP:%.*]] = icmp sle i32 [[TMP5]], [[TMP6]]
132 // CHECK1-NEXT: br i1 [[CMP]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
133 // CHECK1: omp.inner.for.body:
134 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
135 // CHECK1-NEXT: switch i32 [[TMP7]], label [[DOTOMP_SECTIONS_EXIT:%.*]] [
136 // CHECK1-NEXT: i32 0, label [[DOTOMP_SECTIONS_CASE:%.*]]
137 // CHECK1-NEXT: ]
138 // CHECK1: .omp.sections.case:
139 // CHECK1-NEXT: [[TMP8:%.*]] = call i32 @__kmpc_cancellationpoint(ptr @[[GLOB1]], i32 [[TMP0]], i32 3)
140 // CHECK1-NEXT: [[TMP9:%.*]] = icmp ne i32 [[TMP8]], 0
141 // CHECK1-NEXT: br i1 [[TMP9]], label [[DOTCANCEL_EXIT:%.*]], label [[DOTCANCEL_CONTINUE:%.*]]
142 // CHECK1: .cancel.exit:
143 // CHECK1-NEXT: br label [[CANCEL_EXIT:%.*]]
144 // CHECK1: .cancel.continue:
145 // CHECK1-NEXT: [[TMP10:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[TMP0]], i32 3)
146 // CHECK1-NEXT: [[TMP11:%.*]] = icmp ne i32 [[TMP10]], 0
147 // CHECK1-NEXT: br i1 [[TMP11]], label [[DOTCANCEL_EXIT1:%.*]], label [[DOTCANCEL_CONTINUE2:%.*]]
148 // CHECK1: .cancel.exit1:
149 // CHECK1-NEXT: br label [[CANCEL_EXIT]]
150 // CHECK1: .cancel.continue2:
151 // CHECK1-NEXT: br label [[DOTOMP_SECTIONS_EXIT]]
152 // CHECK1: .omp.sections.exit:
153 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
154 // CHECK1: omp.inner.for.inc:
155 // CHECK1-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
156 // CHECK1-NEXT: [[INC:%.*]] = add nsw i32 [[TMP12]], 1
157 // CHECK1-NEXT: store i32 [[INC]], ptr [[DOTOMP_SECTIONS_IV_]], align 4
158 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]]
159 // CHECK1: omp.inner.for.end:
160 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB3]], i32 [[TMP0]])
161 // CHECK1-NEXT: br label [[CANCEL_CONT:%.*]]
162 // CHECK1: cancel.cont:
163 // CHECK1-NEXT: call void @__kmpc_barrier(ptr @[[GLOB4:[0-9]+]], i32 [[TMP0]])
164 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_LB_3]], align 4
165 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_SECTIONS_UB_4]], align 4
166 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_SECTIONS_ST_5]], align 4
167 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_IL_6]], align 4
168 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB3]], i32 [[TMP0]], i32 34, ptr [[DOTOMP_SECTIONS_IL_6]], ptr [[DOTOMP_SECTIONS_LB_3]], ptr [[DOTOMP_SECTIONS_UB_4]], ptr [[DOTOMP_SECTIONS_ST_5]], i32 1, i32 1)
169 // CHECK1-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_4]], align 4
170 // CHECK1-NEXT: [[TMP14:%.*]] = icmp slt i32 [[TMP13]], 1
171 // CHECK1-NEXT: [[TMP15:%.*]] = select i1 [[TMP14]], i32 [[TMP13]], i32 1
172 // CHECK1-NEXT: store i32 [[TMP15]], ptr [[DOTOMP_SECTIONS_UB_4]], align 4
173 // CHECK1-NEXT: [[TMP16:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_LB_3]], align 4
174 // CHECK1-NEXT: store i32 [[TMP16]], ptr [[DOTOMP_SECTIONS_IV_7]], align 4
175 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND8:%.*]]
176 // CHECK1: omp.inner.for.cond8:
177 // CHECK1-NEXT: [[TMP17:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_7]], align 4
178 // CHECK1-NEXT: [[TMP18:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_4]], align 4
179 // CHECK1-NEXT: [[CMP9:%.*]] = icmp sle i32 [[TMP17]], [[TMP18]]
180 // CHECK1-NEXT: br i1 [[CMP9]], label [[OMP_INNER_FOR_BODY10:%.*]], label [[OMP_INNER_FOR_END22:%.*]]
181 // CHECK1: omp.inner.for.body10:
182 // CHECK1-NEXT: [[TMP19:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_7]], align 4
183 // CHECK1-NEXT: switch i32 [[TMP19]], label [[DOTOMP_SECTIONS_EXIT19:%.*]] [
184 // CHECK1-NEXT: i32 0, label [[DOTOMP_SECTIONS_CASE11:%.*]]
185 // CHECK1-NEXT: i32 1, label [[DOTOMP_SECTIONS_CASE14:%.*]]
186 // CHECK1-NEXT: ]
187 // CHECK1: .omp.sections.case11:
188 // CHECK1-NEXT: [[TMP20:%.*]] = call i32 @__kmpc_cancellationpoint(ptr @[[GLOB1]], i32 [[TMP0]], i32 3)
189 // CHECK1-NEXT: [[TMP21:%.*]] = icmp ne i32 [[TMP20]], 0
190 // CHECK1-NEXT: br i1 [[TMP21]], label [[DOTCANCEL_EXIT12:%.*]], label [[DOTCANCEL_CONTINUE13:%.*]]
191 // CHECK1: .cancel.exit12:
192 // CHECK1-NEXT: br label [[CANCEL_EXIT23:%.*]]
193 // CHECK1: cancel.exit:
194 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB3]], i32 [[TMP0]])
195 // CHECK1-NEXT: br label [[CANCEL_CONT]]
196 // CHECK1: .cancel.continue13:
197 // CHECK1-NEXT: br label [[DOTOMP_SECTIONS_EXIT19]]
198 // CHECK1: .omp.sections.case14:
199 // CHECK1-NEXT: [[TMP22:%.*]] = call i32 @__kmpc_cancellationpoint(ptr @[[GLOB1]], i32 [[TMP0]], i32 3)
200 // CHECK1-NEXT: [[TMP23:%.*]] = icmp ne i32 [[TMP22]], 0
201 // CHECK1-NEXT: br i1 [[TMP23]], label [[DOTCANCEL_EXIT15:%.*]], label [[DOTCANCEL_CONTINUE16:%.*]]
202 // CHECK1: .cancel.exit15:
203 // CHECK1-NEXT: br label [[CANCEL_EXIT23]]
204 // CHECK1: .cancel.continue16:
205 // CHECK1-NEXT: [[TMP24:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[TMP0]], i32 3)
206 // CHECK1-NEXT: [[TMP25:%.*]] = icmp ne i32 [[TMP24]], 0
207 // CHECK1-NEXT: br i1 [[TMP25]], label [[DOTCANCEL_EXIT17:%.*]], label [[DOTCANCEL_CONTINUE18:%.*]]
208 // CHECK1: .cancel.exit17:
209 // CHECK1-NEXT: br label [[CANCEL_EXIT23]]
210 // CHECK1: .cancel.continue18:
211 // CHECK1-NEXT: br label [[DOTOMP_SECTIONS_EXIT19]]
212 // CHECK1: .omp.sections.exit19:
213 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC20:%.*]]
214 // CHECK1: omp.inner.for.inc20:
215 // CHECK1-NEXT: [[TMP26:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_7]], align 4
216 // CHECK1-NEXT: [[INC21:%.*]] = add nsw i32 [[TMP26]], 1
217 // CHECK1-NEXT: store i32 [[INC21]], ptr [[DOTOMP_SECTIONS_IV_7]], align 4
218 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND8]]
219 // CHECK1: omp.inner.for.end22:
220 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB3]], i32 [[TMP0]])
221 // CHECK1-NEXT: br label [[CANCEL_CONT24:%.*]]
222 // CHECK1: cancel.cont24:
223 // CHECK1-NEXT: call void @__kmpc_barrier(ptr @[[GLOB4]], i32 [[TMP0]])
224 // CHECK1-NEXT: [[TMP27:%.*]] = load i32, ptr [[ARGC_ADDR]], align 4
225 // CHECK1-NEXT: store i32 [[TMP27]], ptr [[DOTCAPTURE_EXPR_]], align 4
226 // CHECK1-NEXT: [[TMP28:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
227 // CHECK1-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP28]], 0
228 // CHECK1-NEXT: [[DIV:%.*]] = sdiv i32 [[SUB]], 1
229 // CHECK1-NEXT: [[SUB26:%.*]] = sub nsw i32 [[DIV]], 1
230 // CHECK1-NEXT: store i32 [[SUB26]], ptr [[DOTCAPTURE_EXPR_25]], align 4
231 // CHECK1-NEXT: store i32 0, ptr [[I]], align 4
232 // CHECK1-NEXT: [[TMP29:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
233 // CHECK1-NEXT: [[CMP27:%.*]] = icmp slt i32 0, [[TMP29]]
234 // CHECK1-NEXT: br i1 [[CMP27]], label [[OMP_PRECOND_THEN:%.*]], label [[OMP_PRECOND_END:%.*]]
235 // CHECK1: omp.precond.then:
236 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
237 // CHECK1-NEXT: [[TMP30:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_25]], align 4
238 // CHECK1-NEXT: store i32 [[TMP30]], ptr [[DOTOMP_UB]], align 4
239 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
240 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
241 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB5:[0-9]+]], i32 [[TMP0]], i32 34, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_LB]], ptr [[DOTOMP_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
242 // CHECK1-NEXT: [[TMP31:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
243 // CHECK1-NEXT: [[TMP32:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_25]], align 4
244 // CHECK1-NEXT: [[CMP29:%.*]] = icmp sgt i32 [[TMP31]], [[TMP32]]
245 // CHECK1-NEXT: br i1 [[CMP29]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
246 // CHECK1: cond.true:
247 // CHECK1-NEXT: [[TMP33:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_25]], align 4
248 // CHECK1-NEXT: br label [[COND_END:%.*]]
249 // CHECK1: cond.false:
250 // CHECK1-NEXT: [[TMP34:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
251 // CHECK1-NEXT: br label [[COND_END]]
252 // CHECK1: cond.end:
253 // CHECK1-NEXT: [[COND:%.*]] = phi i32 [ [[TMP33]], [[COND_TRUE]] ], [ [[TMP34]], [[COND_FALSE]] ]
254 // CHECK1-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
255 // CHECK1-NEXT: [[TMP35:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
256 // CHECK1-NEXT: store i32 [[TMP35]], ptr [[DOTOMP_IV]], align 4
257 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND30:%.*]]
258 // CHECK1: omp.inner.for.cond30:
259 // CHECK1-NEXT: [[TMP36:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
260 // CHECK1-NEXT: [[TMP37:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
261 // CHECK1-NEXT: [[CMP31:%.*]] = icmp sle i32 [[TMP36]], [[TMP37]]
262 // CHECK1-NEXT: br i1 [[CMP31]], label [[OMP_INNER_FOR_BODY32:%.*]], label [[OMP_INNER_FOR_END39:%.*]]
263 // CHECK1: omp.inner.for.body32:
264 // CHECK1-NEXT: [[TMP38:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
265 // CHECK1-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP38]], 1
266 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
267 // CHECK1-NEXT: store i32 [[ADD]], ptr [[I28]], align 4
268 // CHECK1-NEXT: [[TMP39:%.*]] = call i32 @__kmpc_cancellationpoint(ptr @[[GLOB1]], i32 [[TMP0]], i32 2)
269 // CHECK1-NEXT: [[TMP40:%.*]] = icmp ne i32 [[TMP39]], 0
270 // CHECK1-NEXT: br i1 [[TMP40]], label [[DOTCANCEL_EXIT33:%.*]], label [[DOTCANCEL_CONTINUE34:%.*]]
271 // CHECK1: .cancel.exit33:
272 // CHECK1-NEXT: br label [[CANCEL_EXIT40:%.*]]
273 // CHECK1: cancel.exit23:
274 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB3]], i32 [[TMP0]])
275 // CHECK1-NEXT: br label [[CANCEL_CONT24]]
276 // CHECK1: .cancel.continue34:
277 // CHECK1-NEXT: [[TMP41:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[TMP0]], i32 2)
278 // CHECK1-NEXT: [[TMP42:%.*]] = icmp ne i32 [[TMP41]], 0
279 // CHECK1-NEXT: br i1 [[TMP42]], label [[DOTCANCEL_EXIT35:%.*]], label [[DOTCANCEL_CONTINUE36:%.*]]
280 // CHECK1: .cancel.exit35:
281 // CHECK1-NEXT: br label [[CANCEL_EXIT40]]
282 // CHECK1: .cancel.continue36:
283 // CHECK1-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
284 // CHECK1: omp.body.continue:
285 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC37:%.*]]
286 // CHECK1: omp.inner.for.inc37:
287 // CHECK1-NEXT: [[TMP43:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
288 // CHECK1-NEXT: [[ADD38:%.*]] = add nsw i32 [[TMP43]], 1
289 // CHECK1-NEXT: store i32 [[ADD38]], ptr [[DOTOMP_IV]], align 4
290 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND30]]
291 // CHECK1: omp.inner.for.end39:
292 // CHECK1-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
293 // CHECK1: omp.loop.exit:
294 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB5]], i32 [[TMP0]])
295 // CHECK1-NEXT: br label [[OMP_PRECOND_END]]
296 // CHECK1: cancel.exit40:
297 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB5]], i32 [[TMP0]])
298 // CHECK1-NEXT: br label [[CANCEL_CONT41:%.*]]
299 // CHECK1: omp.precond.end:
300 // CHECK1-NEXT: br label [[CANCEL_CONT41]]
301 // CHECK1: cancel.cont41:
302 // CHECK1-NEXT: call void @__kmpc_barrier(ptr @[[GLOB2:[0-9]+]], i32 [[TMP0]])
303 // CHECK1-NEXT: [[TMP44:%.*]] = call ptr @__kmpc_omp_task_alloc(ptr @[[GLOB1]], i32 [[TMP0]], i32 1, i64 40, i64 1, ptr @.omp_task_entry.)
304 // CHECK1-NEXT: [[TMP45:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_T_WITH_PRIVATES:%.*]], ptr [[TMP44]], i32 0, i32 0
305 // CHECK1-NEXT: [[TMP46:%.*]] = call i32 @__kmpc_omp_task(ptr @[[GLOB1]], i32 [[TMP0]], ptr [[TMP44]])
306 // CHECK1-NEXT: [[TMP47:%.*]] = call ptr @__kmpc_omp_task_alloc(ptr @[[GLOB1]], i32 [[TMP0]], i32 1, i64 40, i64 1, ptr @.omp_task_entry..2)
307 // CHECK1-NEXT: [[TMP48:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_T_WITH_PRIVATES_1:%.*]], ptr [[TMP47]], i32 0, i32 0
308 // CHECK1-NEXT: [[TMP49:%.*]] = call i32 @__kmpc_omp_task(ptr @[[GLOB1]], i32 [[TMP0]], ptr [[TMP47]])
309 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB1]], i32 0, ptr @main.omp_outlined.3)
310 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB1]], i32 0, ptr @main.omp_outlined.4)
311 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB1]], i32 1, ptr @main.omp_outlined.5, ptr [[ARGC_ADDR]])
312 // CHECK1-NEXT: [[TMP50:%.*]] = load i32, ptr [[ARGC_ADDR]], align 4
313 // CHECK1-NEXT: ret i32 [[TMP50]]
316 // CHECK1-LABEL: define {{[^@]+}}@main.omp_outlined
317 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 8 dereferenceable(8) [[ARGV:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[ARGC:%.*]]) #[[ATTR1:[0-9]+]] {
318 // CHECK1-NEXT: entry:
319 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
320 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
321 // CHECK1-NEXT: [[ARGV_ADDR:%.*]] = alloca ptr, align 8
322 // CHECK1-NEXT: [[ARGC_ADDR:%.*]] = alloca ptr, align 8
323 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
324 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
325 // CHECK1-NEXT: store ptr [[ARGV]], ptr [[ARGV_ADDR]], align 8
326 // CHECK1-NEXT: store ptr [[ARGC]], ptr [[ARGC_ADDR]], align 8
327 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[ARGV_ADDR]], align 8
328 // CHECK1-NEXT: [[TMP1:%.*]] = load ptr, ptr [[ARGC_ADDR]], align 8
329 // CHECK1-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
330 // CHECK1-NEXT: [[TMP3:%.*]] = load i32, ptr [[TMP2]], align 4
331 // CHECK1-NEXT: [[TMP4:%.*]] = call i32 @__kmpc_cancellationpoint(ptr @[[GLOB1]], i32 [[TMP3]], i32 1)
332 // CHECK1-NEXT: [[TMP5:%.*]] = icmp ne i32 [[TMP4]], 0
333 // CHECK1-NEXT: br i1 [[TMP5]], label [[DOTCANCEL_EXIT:%.*]], label [[DOTCANCEL_CONTINUE:%.*]]
334 // CHECK1: .cancel.exit:
335 // CHECK1-NEXT: [[TMP6:%.*]] = call i32 @__kmpc_cancel_barrier(ptr @[[GLOB2]], i32 [[TMP3]])
336 // CHECK1-NEXT: br label [[RETURN:%.*]]
337 // CHECK1: .cancel.continue:
338 // CHECK1-NEXT: [[TMP7:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[TMP3]], i32 1)
339 // CHECK1-NEXT: [[TMP8:%.*]] = icmp ne i32 [[TMP7]], 0
340 // CHECK1-NEXT: br i1 [[TMP8]], label [[DOTCANCEL_EXIT1:%.*]], label [[DOTCANCEL_CONTINUE2:%.*]]
341 // CHECK1: .cancel.exit1:
342 // CHECK1-NEXT: [[TMP9:%.*]] = call i32 @__kmpc_cancel_barrier(ptr @[[GLOB2]], i32 [[TMP3]])
343 // CHECK1-NEXT: br label [[RETURN]]
344 // CHECK1: .cancel.continue2:
345 // CHECK1-NEXT: [[TMP10:%.*]] = load i32, ptr [[TMP1]], align 4
346 // CHECK1-NEXT: [[CONV:%.*]] = trunc i32 [[TMP10]] to i8
347 // CHECK1-NEXT: [[TMP11:%.*]] = load ptr, ptr [[TMP0]], align 8
348 // CHECK1-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds ptr, ptr [[TMP11]], i64 0
349 // CHECK1-NEXT: [[TMP12:%.*]] = load ptr, ptr [[ARRAYIDX]], align 8
350 // CHECK1-NEXT: [[ARRAYIDX3:%.*]] = getelementptr inbounds i8, ptr [[TMP12]], i64 0
351 // CHECK1-NEXT: store i8 [[CONV]], ptr [[ARRAYIDX3]], align 1
352 // CHECK1-NEXT: br label [[RETURN]]
353 // CHECK1: return:
354 // CHECK1-NEXT: ret void
357 // CHECK1-LABEL: define {{[^@]+}}@.omp_task_entry.
358 // CHECK1-SAME: (i32 noundef [[TMP0:%.*]], ptr noalias noundef [[TMP1:%.*]]) #[[ATTR4:[0-9]+]] {
359 // CHECK1-NEXT: entry:
360 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR_I:%.*]] = alloca i32, align 4
361 // CHECK1-NEXT: [[DOTPART_ID__ADDR_I:%.*]] = alloca ptr, align 8
362 // CHECK1-NEXT: [[DOTPRIVATES__ADDR_I:%.*]] = alloca ptr, align 8
363 // CHECK1-NEXT: [[DOTCOPY_FN__ADDR_I:%.*]] = alloca ptr, align 8
364 // CHECK1-NEXT: [[DOTTASK_T__ADDR_I:%.*]] = alloca ptr, align 8
365 // CHECK1-NEXT: [[__CONTEXT_ADDR_I:%.*]] = alloca ptr, align 8
366 // CHECK1-NEXT: [[CLEANUP_DEST_SLOT_I:%.*]] = alloca i32, align 4
367 // CHECK1-NEXT: [[DOTADDR:%.*]] = alloca i32, align 4
368 // CHECK1-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 8
369 // CHECK1-NEXT: store i32 [[TMP0]], ptr [[DOTADDR]], align 4
370 // CHECK1-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 8
371 // CHECK1-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTADDR]], align 4
372 // CHECK1-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 8
373 // CHECK1-NEXT: [[TMP4:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_T_WITH_PRIVATES:%.*]], ptr [[TMP3]], i32 0, i32 0
374 // CHECK1-NEXT: [[TMP5:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_T:%.*]], ptr [[TMP4]], i32 0, i32 2
375 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_T]], ptr [[TMP4]], i32 0, i32 0
376 // CHECK1-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 8
377 // CHECK1-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META5:![0-9]+]])
378 // CHECK1-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META8:![0-9]+]])
379 // CHECK1-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META10:![0-9]+]])
380 // CHECK1-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META12:![0-9]+]])
381 // CHECK1-NEXT: store i32 [[TMP2]], ptr [[DOTGLOBAL_TID__ADDR_I]], align 4, !noalias !14
382 // CHECK1-NEXT: store ptr [[TMP5]], ptr [[DOTPART_ID__ADDR_I]], align 8, !noalias !14
383 // CHECK1-NEXT: store ptr null, ptr [[DOTPRIVATES__ADDR_I]], align 8, !noalias !14
384 // CHECK1-NEXT: store ptr null, ptr [[DOTCOPY_FN__ADDR_I]], align 8, !noalias !14
385 // CHECK1-NEXT: store ptr [[TMP3]], ptr [[DOTTASK_T__ADDR_I]], align 8, !noalias !14
386 // CHECK1-NEXT: store ptr [[TMP7]], ptr [[__CONTEXT_ADDR_I]], align 8, !noalias !14
387 // CHECK1-NEXT: [[TMP8:%.*]] = load ptr, ptr [[__CONTEXT_ADDR_I]], align 8, !noalias !14
388 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTGLOBAL_TID__ADDR_I]], align 4, !noalias !14
389 // CHECK1-NEXT: [[TMP10:%.*]] = call i32 @__kmpc_cancellationpoint(ptr @[[GLOB1]], i32 [[TMP9]], i32 4)
390 // CHECK1-NEXT: [[TMP11:%.*]] = icmp ne i32 [[TMP10]], 0
391 // CHECK1-NEXT: br i1 [[TMP11]], label [[DOTCANCEL_EXIT_I:%.*]], label [[DOTCANCEL_CONTINUE_I:%.*]]
392 // CHECK1: .cancel.exit.i:
393 // CHECK1-NEXT: store i32 1, ptr [[CLEANUP_DEST_SLOT_I]], align 4, !noalias !14
394 // CHECK1-NEXT: br label [[DOTOMP_OUTLINED__EXIT:%.*]]
395 // CHECK1: .cancel.continue.i:
396 // CHECK1-NEXT: [[TMP12:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[TMP9]], i32 4)
397 // CHECK1-NEXT: [[TMP13:%.*]] = icmp ne i32 [[TMP12]], 0
398 // CHECK1-NEXT: br i1 [[TMP13]], label [[DOTCANCEL_EXIT1_I:%.*]], label [[DOTCANCEL_CONTINUE2_I:%.*]]
399 // CHECK1: .cancel.exit1.i:
400 // CHECK1-NEXT: store i32 1, ptr [[CLEANUP_DEST_SLOT_I]], align 4, !noalias !14
401 // CHECK1-NEXT: br label [[DOTOMP_OUTLINED__EXIT]]
402 // CHECK1: .cancel.continue2.i:
403 // CHECK1-NEXT: store i32 0, ptr [[CLEANUP_DEST_SLOT_I]], align 4, !noalias !14
404 // CHECK1-NEXT: br label [[DOTOMP_OUTLINED__EXIT]]
405 // CHECK1: .omp_outlined..exit:
406 // CHECK1-NEXT: [[CLEANUP_DEST_I:%.*]] = load i32, ptr [[CLEANUP_DEST_SLOT_I]], align 4, !noalias !14
407 // CHECK1-NEXT: ret i32 0
410 // CHECK1-LABEL: define {{[^@]+}}@.omp_task_entry..2
411 // CHECK1-SAME: (i32 noundef [[TMP0:%.*]], ptr noalias noundef [[TMP1:%.*]]) #[[ATTR4]] {
412 // CHECK1-NEXT: entry:
413 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR_I:%.*]] = alloca i32, align 4
414 // CHECK1-NEXT: [[DOTPART_ID__ADDR_I:%.*]] = alloca ptr, align 8
415 // CHECK1-NEXT: [[DOTPRIVATES__ADDR_I:%.*]] = alloca ptr, align 8
416 // CHECK1-NEXT: [[DOTCOPY_FN__ADDR_I:%.*]] = alloca ptr, align 8
417 // CHECK1-NEXT: [[DOTTASK_T__ADDR_I:%.*]] = alloca ptr, align 8
418 // CHECK1-NEXT: [[__CONTEXT_ADDR_I:%.*]] = alloca ptr, align 8
419 // CHECK1-NEXT: [[CLEANUP_DEST_SLOT_I:%.*]] = alloca i32, align 4
420 // CHECK1-NEXT: [[DOTADDR:%.*]] = alloca i32, align 4
421 // CHECK1-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 8
422 // CHECK1-NEXT: store i32 [[TMP0]], ptr [[DOTADDR]], align 4
423 // CHECK1-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 8
424 // CHECK1-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTADDR]], align 4
425 // CHECK1-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 8
426 // CHECK1-NEXT: [[TMP4:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_T_WITH_PRIVATES_1:%.*]], ptr [[TMP3]], i32 0, i32 0
427 // CHECK1-NEXT: [[TMP5:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_T:%.*]], ptr [[TMP4]], i32 0, i32 2
428 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_T]], ptr [[TMP4]], i32 0, i32 0
429 // CHECK1-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 8
430 // CHECK1-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META15:![0-9]+]])
431 // CHECK1-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META18:![0-9]+]])
432 // CHECK1-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META20:![0-9]+]])
433 // CHECK1-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META22:![0-9]+]])
434 // CHECK1-NEXT: store i32 [[TMP2]], ptr [[DOTGLOBAL_TID__ADDR_I]], align 4, !noalias !24
435 // CHECK1-NEXT: store ptr [[TMP5]], ptr [[DOTPART_ID__ADDR_I]], align 8, !noalias !24
436 // CHECK1-NEXT: store ptr null, ptr [[DOTPRIVATES__ADDR_I]], align 8, !noalias !24
437 // CHECK1-NEXT: store ptr null, ptr [[DOTCOPY_FN__ADDR_I]], align 8, !noalias !24
438 // CHECK1-NEXT: store ptr [[TMP3]], ptr [[DOTTASK_T__ADDR_I]], align 8, !noalias !24
439 // CHECK1-NEXT: store ptr [[TMP7]], ptr [[__CONTEXT_ADDR_I]], align 8, !noalias !24
440 // CHECK1-NEXT: [[TMP8:%.*]] = load ptr, ptr [[__CONTEXT_ADDR_I]], align 8, !noalias !24
441 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTGLOBAL_TID__ADDR_I]], align 4, !noalias !24
442 // CHECK1-NEXT: [[TMP10:%.*]] = call i32 @__kmpc_cancellationpoint(ptr @[[GLOB1]], i32 [[TMP9]], i32 4)
443 // CHECK1-NEXT: [[TMP11:%.*]] = icmp ne i32 [[TMP10]], 0
444 // CHECK1-NEXT: br i1 [[TMP11]], label [[DOTCANCEL_EXIT_I:%.*]], label [[DOTCANCEL_CONTINUE_I:%.*]]
445 // CHECK1: .cancel.exit.i:
446 // CHECK1-NEXT: store i32 1, ptr [[CLEANUP_DEST_SLOT_I]], align 4, !noalias !24
447 // CHECK1-NEXT: br label [[DOTOMP_OUTLINED__1_EXIT:%.*]]
448 // CHECK1: .cancel.continue.i:
449 // CHECK1-NEXT: store i32 0, ptr [[CLEANUP_DEST_SLOT_I]], align 4, !noalias !24
450 // CHECK1-NEXT: br label [[DOTOMP_OUTLINED__1_EXIT]]
451 // CHECK1: .omp_outlined..1.exit:
452 // CHECK1-NEXT: [[CLEANUP_DEST_I:%.*]] = load i32, ptr [[CLEANUP_DEST_SLOT_I]], align 4, !noalias !24
453 // CHECK1-NEXT: ret i32 0
456 // CHECK1-LABEL: define {{[^@]+}}@main.omp_outlined.3
457 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]]) #[[ATTR1]] {
458 // CHECK1-NEXT: entry:
459 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
460 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
461 // CHECK1-NEXT: [[DOTOMP_SECTIONS_LB_:%.*]] = alloca i32, align 4
462 // CHECK1-NEXT: [[DOTOMP_SECTIONS_UB_:%.*]] = alloca i32, align 4
463 // CHECK1-NEXT: [[DOTOMP_SECTIONS_ST_:%.*]] = alloca i32, align 4
464 // CHECK1-NEXT: [[DOTOMP_SECTIONS_IL_:%.*]] = alloca i32, align 4
465 // CHECK1-NEXT: [[DOTOMP_SECTIONS_IV_:%.*]] = alloca i32, align 4
466 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
467 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
468 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_LB_]], align 4
469 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_UB_]], align 4
470 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_SECTIONS_ST_]], align 4
471 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_IL_]], align 4
472 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
473 // CHECK1-NEXT: [[TMP1:%.*]] = load i32, ptr [[TMP0]], align 4
474 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB3]], i32 [[TMP1]], i32 34, ptr [[DOTOMP_SECTIONS_IL_]], ptr [[DOTOMP_SECTIONS_LB_]], ptr [[DOTOMP_SECTIONS_UB_]], ptr [[DOTOMP_SECTIONS_ST_]], i32 1, i32 1)
475 // CHECK1-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_]], align 4
476 // CHECK1-NEXT: [[TMP3:%.*]] = icmp slt i32 [[TMP2]], 0
477 // CHECK1-NEXT: [[TMP4:%.*]] = select i1 [[TMP3]], i32 [[TMP2]], i32 0
478 // CHECK1-NEXT: store i32 [[TMP4]], ptr [[DOTOMP_SECTIONS_UB_]], align 4
479 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_LB_]], align 4
480 // CHECK1-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_SECTIONS_IV_]], align 4
481 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
482 // CHECK1: omp.inner.for.cond:
483 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
484 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_]], align 4
485 // CHECK1-NEXT: [[CMP:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
486 // CHECK1-NEXT: br i1 [[CMP]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
487 // CHECK1: omp.inner.for.body:
488 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
489 // CHECK1-NEXT: switch i32 [[TMP8]], label [[DOTOMP_SECTIONS_EXIT:%.*]] [
490 // CHECK1-NEXT: i32 0, label [[DOTOMP_SECTIONS_CASE:%.*]]
491 // CHECK1-NEXT: ]
492 // CHECK1: .omp.sections.case:
493 // CHECK1-NEXT: [[TMP9:%.*]] = call i32 @__kmpc_cancellationpoint(ptr @[[GLOB1]], i32 [[TMP1]], i32 3)
494 // CHECK1-NEXT: [[TMP10:%.*]] = icmp ne i32 [[TMP9]], 0
495 // CHECK1-NEXT: br i1 [[TMP10]], label [[DOTCANCEL_EXIT:%.*]], label [[DOTCANCEL_CONTINUE:%.*]]
496 // CHECK1: .cancel.exit:
497 // CHECK1-NEXT: br label [[CANCEL_EXIT:%.*]]
498 // CHECK1: .cancel.continue:
499 // CHECK1-NEXT: [[TMP11:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[TMP1]], i32 3)
500 // CHECK1-NEXT: [[TMP12:%.*]] = icmp ne i32 [[TMP11]], 0
501 // CHECK1-NEXT: br i1 [[TMP12]], label [[DOTCANCEL_EXIT1:%.*]], label [[DOTCANCEL_CONTINUE2:%.*]]
502 // CHECK1: .cancel.exit1:
503 // CHECK1-NEXT: br label [[CANCEL_EXIT]]
504 // CHECK1: .cancel.continue2:
505 // CHECK1-NEXT: br label [[DOTOMP_SECTIONS_EXIT]]
506 // CHECK1: .omp.sections.exit:
507 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
508 // CHECK1: omp.inner.for.inc:
509 // CHECK1-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
510 // CHECK1-NEXT: [[INC:%.*]] = add nsw i32 [[TMP13]], 1
511 // CHECK1-NEXT: store i32 [[INC]], ptr [[DOTOMP_SECTIONS_IV_]], align 4
512 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]]
513 // CHECK1: omp.inner.for.end:
514 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB3]], i32 [[TMP1]])
515 // CHECK1-NEXT: br label [[CANCEL_CONT:%.*]]
516 // CHECK1: cancel.cont:
517 // CHECK1-NEXT: ret void
518 // CHECK1: cancel.exit:
519 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB3]], i32 [[TMP1]])
520 // CHECK1-NEXT: br label [[CANCEL_CONT]]
523 // CHECK1-LABEL: define {{[^@]+}}@main.omp_outlined.4
524 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]]) #[[ATTR1]] {
525 // CHECK1-NEXT: entry:
526 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
527 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
528 // CHECK1-NEXT: [[DOTOMP_SECTIONS_LB_:%.*]] = alloca i32, align 4
529 // CHECK1-NEXT: [[DOTOMP_SECTIONS_UB_:%.*]] = alloca i32, align 4
530 // CHECK1-NEXT: [[DOTOMP_SECTIONS_ST_:%.*]] = alloca i32, align 4
531 // CHECK1-NEXT: [[DOTOMP_SECTIONS_IL_:%.*]] = alloca i32, align 4
532 // CHECK1-NEXT: [[DOTOMP_SECTIONS_IV_:%.*]] = alloca i32, align 4
533 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
534 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
535 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_LB_]], align 4
536 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_SECTIONS_UB_]], align 4
537 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_SECTIONS_ST_]], align 4
538 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_IL_]], align 4
539 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
540 // CHECK1-NEXT: [[TMP1:%.*]] = load i32, ptr [[TMP0]], align 4
541 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB3]], i32 [[TMP1]], i32 34, ptr [[DOTOMP_SECTIONS_IL_]], ptr [[DOTOMP_SECTIONS_LB_]], ptr [[DOTOMP_SECTIONS_UB_]], ptr [[DOTOMP_SECTIONS_ST_]], i32 1, i32 1)
542 // CHECK1-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_]], align 4
543 // CHECK1-NEXT: [[TMP3:%.*]] = icmp slt i32 [[TMP2]], 1
544 // CHECK1-NEXT: [[TMP4:%.*]] = select i1 [[TMP3]], i32 [[TMP2]], i32 1
545 // CHECK1-NEXT: store i32 [[TMP4]], ptr [[DOTOMP_SECTIONS_UB_]], align 4
546 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_LB_]], align 4
547 // CHECK1-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_SECTIONS_IV_]], align 4
548 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
549 // CHECK1: omp.inner.for.cond:
550 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
551 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_]], align 4
552 // CHECK1-NEXT: [[CMP:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
553 // CHECK1-NEXT: br i1 [[CMP]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
554 // CHECK1: omp.inner.for.body:
555 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
556 // CHECK1-NEXT: switch i32 [[TMP8]], label [[DOTOMP_SECTIONS_EXIT:%.*]] [
557 // CHECK1-NEXT: i32 0, label [[DOTOMP_SECTIONS_CASE:%.*]]
558 // CHECK1-NEXT: i32 1, label [[DOTOMP_SECTIONS_CASE3:%.*]]
559 // CHECK1-NEXT: ]
560 // CHECK1: .omp.sections.case:
561 // CHECK1-NEXT: [[TMP9:%.*]] = call i32 @__kmpc_cancellationpoint(ptr @[[GLOB1]], i32 [[TMP1]], i32 3)
562 // CHECK1-NEXT: [[TMP10:%.*]] = icmp ne i32 [[TMP9]], 0
563 // CHECK1-NEXT: br i1 [[TMP10]], label [[DOTCANCEL_EXIT:%.*]], label [[DOTCANCEL_CONTINUE:%.*]]
564 // CHECK1: .cancel.exit:
565 // CHECK1-NEXT: br label [[CANCEL_EXIT:%.*]]
566 // CHECK1: .cancel.continue:
567 // CHECK1-NEXT: [[TMP11:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[TMP1]], i32 3)
568 // CHECK1-NEXT: [[TMP12:%.*]] = icmp ne i32 [[TMP11]], 0
569 // CHECK1-NEXT: br i1 [[TMP12]], label [[DOTCANCEL_EXIT1:%.*]], label [[DOTCANCEL_CONTINUE2:%.*]]
570 // CHECK1: .cancel.exit1:
571 // CHECK1-NEXT: br label [[CANCEL_EXIT]]
572 // CHECK1: .cancel.continue2:
573 // CHECK1-NEXT: br label [[DOTOMP_SECTIONS_EXIT]]
574 // CHECK1: .omp.sections.case3:
575 // CHECK1-NEXT: [[TMP13:%.*]] = call i32 @__kmpc_cancellationpoint(ptr @[[GLOB1]], i32 [[TMP1]], i32 3)
576 // CHECK1-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
577 // CHECK1-NEXT: br i1 [[TMP14]], label [[DOTCANCEL_EXIT4:%.*]], label [[DOTCANCEL_CONTINUE5:%.*]]
578 // CHECK1: .cancel.exit4:
579 // CHECK1-NEXT: br label [[CANCEL_EXIT]]
580 // CHECK1: .cancel.continue5:
581 // CHECK1-NEXT: br label [[DOTOMP_SECTIONS_EXIT]]
582 // CHECK1: .omp.sections.exit:
583 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
584 // CHECK1: omp.inner.for.inc:
585 // CHECK1-NEXT: [[TMP15:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
586 // CHECK1-NEXT: [[INC:%.*]] = add nsw i32 [[TMP15]], 1
587 // CHECK1-NEXT: store i32 [[INC]], ptr [[DOTOMP_SECTIONS_IV_]], align 4
588 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]]
589 // CHECK1: omp.inner.for.end:
590 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB3]], i32 [[TMP1]])
591 // CHECK1-NEXT: br label [[CANCEL_CONT:%.*]]
592 // CHECK1: cancel.cont:
593 // CHECK1-NEXT: ret void
594 // CHECK1: cancel.exit:
595 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB3]], i32 [[TMP1]])
596 // CHECK1-NEXT: br label [[CANCEL_CONT]]
599 // CHECK1-LABEL: define {{[^@]+}}@main.omp_outlined.5
600 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[ARGC:%.*]]) #[[ATTR1]] {
601 // CHECK1-NEXT: entry:
602 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
603 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
604 // CHECK1-NEXT: [[ARGC_ADDR:%.*]] = alloca ptr, align 8
605 // CHECK1-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
606 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
607 // CHECK1-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
608 // CHECK1-NEXT: [[DOTCAPTURE_EXPR_1:%.*]] = alloca i32, align 4
609 // CHECK1-NEXT: [[I:%.*]] = alloca i32, align 4
610 // CHECK1-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
611 // CHECK1-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
612 // CHECK1-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
613 // CHECK1-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
614 // CHECK1-NEXT: [[I3:%.*]] = alloca i32, align 4
615 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
616 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
617 // CHECK1-NEXT: store ptr [[ARGC]], ptr [[ARGC_ADDR]], align 8
618 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[ARGC_ADDR]], align 8
619 // CHECK1-NEXT: [[TMP1:%.*]] = load i32, ptr [[TMP0]], align 4
620 // CHECK1-NEXT: store i32 [[TMP1]], ptr [[DOTCAPTURE_EXPR_]], align 4
621 // CHECK1-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
622 // CHECK1-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP2]], 0
623 // CHECK1-NEXT: [[DIV:%.*]] = sdiv i32 [[SUB]], 1
624 // CHECK1-NEXT: [[SUB2:%.*]] = sub nsw i32 [[DIV]], 1
625 // CHECK1-NEXT: store i32 [[SUB2]], ptr [[DOTCAPTURE_EXPR_1]], align 4
626 // CHECK1-NEXT: store i32 0, ptr [[I]], align 4
627 // CHECK1-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
628 // CHECK1-NEXT: [[CMP:%.*]] = icmp slt i32 0, [[TMP3]]
629 // CHECK1-NEXT: br i1 [[CMP]], label [[OMP_PRECOND_THEN:%.*]], label [[OMP_PRECOND_END:%.*]]
630 // CHECK1: omp.precond.then:
631 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
632 // CHECK1-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
633 // CHECK1-NEXT: store i32 [[TMP4]], ptr [[DOTOMP_UB]], align 4
634 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
635 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
636 // CHECK1-NEXT: [[TMP5:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
637 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[TMP5]], align 4
638 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB5]], i32 [[TMP6]], i32 34, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_LB]], ptr [[DOTOMP_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
639 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
640 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
641 // CHECK1-NEXT: [[CMP4:%.*]] = icmp sgt i32 [[TMP7]], [[TMP8]]
642 // CHECK1-NEXT: br i1 [[CMP4]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
643 // CHECK1: cond.true:
644 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
645 // CHECK1-NEXT: br label [[COND_END:%.*]]
646 // CHECK1: cond.false:
647 // CHECK1-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
648 // CHECK1-NEXT: br label [[COND_END]]
649 // CHECK1: cond.end:
650 // CHECK1-NEXT: [[COND:%.*]] = phi i32 [ [[TMP9]], [[COND_TRUE]] ], [ [[TMP10]], [[COND_FALSE]] ]
651 // CHECK1-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
652 // CHECK1-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
653 // CHECK1-NEXT: store i32 [[TMP11]], ptr [[DOTOMP_IV]], align 4
654 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
655 // CHECK1: omp.inner.for.cond:
656 // CHECK1-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
657 // CHECK1-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
658 // CHECK1-NEXT: [[CMP5:%.*]] = icmp sle i32 [[TMP12]], [[TMP13]]
659 // CHECK1-NEXT: br i1 [[CMP5]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
660 // CHECK1: omp.inner.for.body:
661 // CHECK1-NEXT: [[TMP14:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
662 // CHECK1-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP14]], 1
663 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
664 // CHECK1-NEXT: store i32 [[ADD]], ptr [[I3]], align 4
665 // CHECK1-NEXT: [[TMP15:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
666 // CHECK1-NEXT: [[TMP16:%.*]] = load i32, ptr [[TMP15]], align 4
667 // CHECK1-NEXT: [[TMP17:%.*]] = call i32 @__kmpc_cancellationpoint(ptr @[[GLOB1]], i32 [[TMP16]], i32 2)
668 // CHECK1-NEXT: [[TMP18:%.*]] = icmp ne i32 [[TMP17]], 0
669 // CHECK1-NEXT: br i1 [[TMP18]], label [[DOTCANCEL_EXIT:%.*]], label [[DOTCANCEL_CONTINUE:%.*]]
670 // CHECK1: .cancel.exit:
671 // CHECK1-NEXT: br label [[CANCEL_EXIT:%.*]]
672 // CHECK1: .cancel.continue:
673 // CHECK1-NEXT: [[TMP19:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
674 // CHECK1-NEXT: [[TMP20:%.*]] = load i32, ptr [[TMP19]], align 4
675 // CHECK1-NEXT: [[TMP21:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[TMP20]], i32 2)
676 // CHECK1-NEXT: [[TMP22:%.*]] = icmp ne i32 [[TMP21]], 0
677 // CHECK1-NEXT: br i1 [[TMP22]], label [[DOTCANCEL_EXIT6:%.*]], label [[DOTCANCEL_CONTINUE7:%.*]]
678 // CHECK1: .cancel.exit6:
679 // CHECK1-NEXT: br label [[CANCEL_EXIT]]
680 // CHECK1: .cancel.continue7:
681 // CHECK1-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
682 // CHECK1: omp.body.continue:
683 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
684 // CHECK1: omp.inner.for.inc:
685 // CHECK1-NEXT: [[TMP23:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
686 // CHECK1-NEXT: [[ADD8:%.*]] = add nsw i32 [[TMP23]], 1
687 // CHECK1-NEXT: store i32 [[ADD8]], ptr [[DOTOMP_IV]], align 4
688 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]]
689 // CHECK1: omp.inner.for.end:
690 // CHECK1-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
691 // CHECK1: omp.loop.exit:
692 // CHECK1-NEXT: [[TMP24:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
693 // CHECK1-NEXT: [[TMP25:%.*]] = load i32, ptr [[TMP24]], align 4
694 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB5]], i32 [[TMP25]])
695 // CHECK1-NEXT: br label [[OMP_PRECOND_END]]
696 // CHECK1: cancel.exit:
697 // CHECK1-NEXT: [[TMP26:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
698 // CHECK1-NEXT: [[TMP27:%.*]] = load i32, ptr [[TMP26]], align 4
699 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB5]], i32 [[TMP27]])
700 // CHECK1-NEXT: br label [[CANCEL_CONT:%.*]]
701 // CHECK1: omp.precond.end:
702 // CHECK1-NEXT: br label [[CANCEL_CONT]]
703 // CHECK1: cancel.cont:
704 // CHECK1-NEXT: ret void