Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / cancel_codegen.cpp
blob53580e0c2b0293fec3874029136de89010c5406f
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 -fopenmp-version=45 -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK1
3 // RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t.0 %s
4 // RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -include-pch %t.0 -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 -fopenmp-version=45 -fopenmp-enable-irbuilder -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK3
7 // RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-enable-irbuilder -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t.1 %s
8 // RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-enable-irbuilder -std=c++11 -include-pch %t.1 -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefix=CHECK3
10 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
11 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t.2 %s
12 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -std=c++11 -include-pch %t.2 -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
14 // RUN: %clang_cc1 -verify -fopenmp -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK1
15 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t.3 %s
16 // RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t.3 -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefix=CHECK1
18 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-enable-irbuilder -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK3
19 // RUN: %clang_cc1 -fopenmp -fopenmp-enable-irbuilder -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t.4 %s
20 // RUN: %clang_cc1 -fopenmp -fopenmp-enable-irbuilder -std=c++11 -include-pch %t.4 -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --check-prefix=CHECK3
22 // RUN: %clang_cc1 -verify -fopenmp-simd -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
23 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t.5 %s
24 // RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t.5 -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
26 // expected-no-diagnostics
27 #ifndef HEADER
28 #define HEADER
30 float flag;
31 int main (int argc, char **argv) {
32 #pragma omp parallel
34 #pragma omp cancel parallel if(flag)
35 argv[0][0] = argc;
36 #pragma omp barrier
37 argv[0][0] += argc;
39 #pragma omp sections
41 #pragma omp cancel sections
43 #pragma omp sections
45 #pragma omp cancel sections
46 #pragma omp section
48 #pragma omp cancel sections
51 #pragma omp for
52 for (int i = 0; i < argc; ++i) {
53 #pragma omp cancel for if(cancel: flag)
55 #pragma omp task
57 #pragma omp cancel taskgroup
59 #pragma omp parallel sections
61 #pragma omp cancel sections
63 #pragma omp parallel sections
65 #pragma omp cancel sections
66 #pragma omp section
68 #pragma omp cancel sections
71 int r = 0;
72 #pragma omp parallel for reduction(+: r)
73 for (int i = 0; i < argc; ++i) {
74 #pragma omp cancel for
75 r += i;
77 return argc;
80 #endif
81 // CHECK1-LABEL: define {{[^@]+}}@main
82 // CHECK1-SAME: (i32 noundef [[ARGC:%.*]], ptr noundef [[ARGV:%.*]]) #[[ATTR0:[0-9]+]] {
83 // CHECK1-NEXT: entry:
84 // CHECK1-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
85 // CHECK1-NEXT: [[ARGC_ADDR:%.*]] = alloca i32, align 4
86 // CHECK1-NEXT: [[ARGV_ADDR:%.*]] = alloca ptr, align 8
87 // CHECK1-NEXT: [[DOTOMP_SECTIONS_LB_:%.*]] = alloca i32, align 4
88 // CHECK1-NEXT: [[DOTOMP_SECTIONS_UB_:%.*]] = alloca i32, align 4
89 // CHECK1-NEXT: [[DOTOMP_SECTIONS_ST_:%.*]] = alloca i32, align 4
90 // CHECK1-NEXT: [[DOTOMP_SECTIONS_IL_:%.*]] = alloca i32, align 4
91 // CHECK1-NEXT: [[DOTOMP_SECTIONS_IV_:%.*]] = alloca i32, align 4
92 // CHECK1-NEXT: [[DOTOMP_SECTIONS_LB_1:%.*]] = alloca i32, align 4
93 // CHECK1-NEXT: [[DOTOMP_SECTIONS_UB_2:%.*]] = alloca i32, align 4
94 // CHECK1-NEXT: [[DOTOMP_SECTIONS_ST_3:%.*]] = alloca i32, align 4
95 // CHECK1-NEXT: [[DOTOMP_SECTIONS_IL_4:%.*]] = alloca i32, align 4
96 // CHECK1-NEXT: [[DOTOMP_SECTIONS_IV_5:%.*]] = alloca i32, align 4
97 // CHECK1-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
98 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
99 // CHECK1-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
100 // CHECK1-NEXT: [[DOTCAPTURE_EXPR_21:%.*]] = alloca i32, align 4
101 // CHECK1-NEXT: [[I:%.*]] = alloca i32, align 4
102 // CHECK1-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
103 // CHECK1-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
104 // CHECK1-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
105 // CHECK1-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
106 // CHECK1-NEXT: [[I24:%.*]] = alloca i32, align 4
107 // CHECK1-NEXT: [[AGG_CAPTURED:%.*]] = alloca [[STRUCT_ANON:%.*]], align 1
108 // CHECK1-NEXT: [[R:%.*]] = alloca i32, align 4
109 // CHECK1-NEXT: [[TMP0:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1:[0-9]+]])
110 // CHECK1-NEXT: store i32 0, ptr [[RETVAL]], align 4
111 // CHECK1-NEXT: store i32 [[ARGC]], ptr [[ARGC_ADDR]], align 4
112 // CHECK1-NEXT: store ptr [[ARGV]], ptr [[ARGV_ADDR]], align 8
113 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB1]], i32 2, ptr @main.omp_outlined, ptr [[ARGV_ADDR]], ptr [[ARGC_ADDR]])
114 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_LB_]], align 4
115 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_UB_]], align 4
116 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_SECTIONS_ST_]], align 4
117 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_IL_]], align 4
118 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB4:[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)
119 // CHECK1-NEXT: [[TMP1:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_]], align 4
120 // CHECK1-NEXT: [[TMP2:%.*]] = icmp slt i32 [[TMP1]], 0
121 // CHECK1-NEXT: [[TMP3:%.*]] = select i1 [[TMP2]], i32 [[TMP1]], i32 0
122 // CHECK1-NEXT: store i32 [[TMP3]], ptr [[DOTOMP_SECTIONS_UB_]], align 4
123 // CHECK1-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_LB_]], align 4
124 // CHECK1-NEXT: store i32 [[TMP4]], ptr [[DOTOMP_SECTIONS_IV_]], align 4
125 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
126 // CHECK1: omp.inner.for.cond:
127 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
128 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_]], align 4
129 // CHECK1-NEXT: [[CMP:%.*]] = icmp sle i32 [[TMP5]], [[TMP6]]
130 // CHECK1-NEXT: br i1 [[CMP]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
131 // CHECK1: omp.inner.for.body:
132 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
133 // CHECK1-NEXT: switch i32 [[TMP7]], label [[DOTOMP_SECTIONS_EXIT:%.*]] [
134 // CHECK1-NEXT: i32 0, label [[DOTOMP_SECTIONS_CASE:%.*]]
135 // CHECK1-NEXT: ]
136 // CHECK1: .omp.sections.case:
137 // CHECK1-NEXT: [[TMP8:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[TMP0]], i32 3)
138 // CHECK1-NEXT: [[TMP9:%.*]] = icmp ne i32 [[TMP8]], 0
139 // CHECK1-NEXT: br i1 [[TMP9]], label [[DOTCANCEL_EXIT:%.*]], label [[DOTCANCEL_CONTINUE:%.*]]
140 // CHECK1: .cancel.exit:
141 // CHECK1-NEXT: br label [[CANCEL_EXIT:%.*]]
142 // CHECK1: .cancel.continue:
143 // CHECK1-NEXT: br label [[DOTOMP_SECTIONS_EXIT]]
144 // CHECK1: .omp.sections.exit:
145 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
146 // CHECK1: omp.inner.for.inc:
147 // CHECK1-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
148 // CHECK1-NEXT: [[INC:%.*]] = add nsw i32 [[TMP10]], 1
149 // CHECK1-NEXT: store i32 [[INC]], ptr [[DOTOMP_SECTIONS_IV_]], align 4
150 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]]
151 // CHECK1: omp.inner.for.end:
152 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB4]], i32 [[TMP0]])
153 // CHECK1-NEXT: br label [[CANCEL_CONT:%.*]]
154 // CHECK1: cancel.cont:
155 // CHECK1-NEXT: call void @__kmpc_barrier(ptr @[[GLOB5:[0-9]+]], i32 [[TMP0]])
156 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_LB_1]], align 4
157 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_SECTIONS_UB_2]], align 4
158 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_SECTIONS_ST_3]], align 4
159 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_IL_4]], align 4
160 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB4]], i32 [[TMP0]], i32 34, ptr [[DOTOMP_SECTIONS_IL_4]], ptr [[DOTOMP_SECTIONS_LB_1]], ptr [[DOTOMP_SECTIONS_UB_2]], ptr [[DOTOMP_SECTIONS_ST_3]], i32 1, i32 1)
161 // CHECK1-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_2]], align 4
162 // CHECK1-NEXT: [[TMP12:%.*]] = icmp slt i32 [[TMP11]], 1
163 // CHECK1-NEXT: [[TMP13:%.*]] = select i1 [[TMP12]], i32 [[TMP11]], i32 1
164 // CHECK1-NEXT: store i32 [[TMP13]], ptr [[DOTOMP_SECTIONS_UB_2]], align 4
165 // CHECK1-NEXT: [[TMP14:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_LB_1]], align 4
166 // CHECK1-NEXT: store i32 [[TMP14]], ptr [[DOTOMP_SECTIONS_IV_5]], align 4
167 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND6:%.*]]
168 // CHECK1: omp.inner.for.cond6:
169 // CHECK1-NEXT: [[TMP15:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_5]], align 4
170 // CHECK1-NEXT: [[TMP16:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_2]], align 4
171 // CHECK1-NEXT: [[CMP7:%.*]] = icmp sle i32 [[TMP15]], [[TMP16]]
172 // CHECK1-NEXT: br i1 [[CMP7]], label [[OMP_INNER_FOR_BODY8:%.*]], label [[OMP_INNER_FOR_END18:%.*]]
173 // CHECK1: omp.inner.for.body8:
174 // CHECK1-NEXT: [[TMP17:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_5]], align 4
175 // CHECK1-NEXT: switch i32 [[TMP17]], label [[DOTOMP_SECTIONS_EXIT15:%.*]] [
176 // CHECK1-NEXT: i32 0, label [[DOTOMP_SECTIONS_CASE9:%.*]]
177 // CHECK1-NEXT: i32 1, label [[DOTOMP_SECTIONS_CASE12:%.*]]
178 // CHECK1-NEXT: ]
179 // CHECK1: .omp.sections.case9:
180 // CHECK1-NEXT: [[TMP18:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[TMP0]], i32 3)
181 // CHECK1-NEXT: [[TMP19:%.*]] = icmp ne i32 [[TMP18]], 0
182 // CHECK1-NEXT: br i1 [[TMP19]], label [[DOTCANCEL_EXIT10:%.*]], label [[DOTCANCEL_CONTINUE11:%.*]]
183 // CHECK1: .cancel.exit10:
184 // CHECK1-NEXT: br label [[CANCEL_EXIT19:%.*]]
185 // CHECK1: cancel.exit:
186 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB4]], i32 [[TMP0]])
187 // CHECK1-NEXT: br label [[CANCEL_CONT]]
188 // CHECK1: .cancel.continue11:
189 // CHECK1-NEXT: br label [[DOTOMP_SECTIONS_EXIT15]]
190 // CHECK1: .omp.sections.case12:
191 // CHECK1-NEXT: [[TMP20:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[TMP0]], i32 3)
192 // CHECK1-NEXT: [[TMP21:%.*]] = icmp ne i32 [[TMP20]], 0
193 // CHECK1-NEXT: br i1 [[TMP21]], label [[DOTCANCEL_EXIT13:%.*]], label [[DOTCANCEL_CONTINUE14:%.*]]
194 // CHECK1: .cancel.exit13:
195 // CHECK1-NEXT: br label [[CANCEL_EXIT19]]
196 // CHECK1: .cancel.continue14:
197 // CHECK1-NEXT: br label [[DOTOMP_SECTIONS_EXIT15]]
198 // CHECK1: .omp.sections.exit15:
199 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC16:%.*]]
200 // CHECK1: omp.inner.for.inc16:
201 // CHECK1-NEXT: [[TMP22:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_5]], align 4
202 // CHECK1-NEXT: [[INC17:%.*]] = add nsw i32 [[TMP22]], 1
203 // CHECK1-NEXT: store i32 [[INC17]], ptr [[DOTOMP_SECTIONS_IV_5]], align 4
204 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND6]]
205 // CHECK1: omp.inner.for.end18:
206 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB4]], i32 [[TMP0]])
207 // CHECK1-NEXT: br label [[CANCEL_CONT20:%.*]]
208 // CHECK1: cancel.cont20:
209 // CHECK1-NEXT: call void @__kmpc_barrier(ptr @[[GLOB5]], i32 [[TMP0]])
210 // CHECK1-NEXT: [[TMP23:%.*]] = load i32, ptr [[ARGC_ADDR]], align 4
211 // CHECK1-NEXT: store i32 [[TMP23]], ptr [[DOTCAPTURE_EXPR_]], align 4
212 // CHECK1-NEXT: [[TMP24:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
213 // CHECK1-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP24]], 0
214 // CHECK1-NEXT: [[DIV:%.*]] = sdiv i32 [[SUB]], 1
215 // CHECK1-NEXT: [[SUB22:%.*]] = sub nsw i32 [[DIV]], 1
216 // CHECK1-NEXT: store i32 [[SUB22]], ptr [[DOTCAPTURE_EXPR_21]], align 4
217 // CHECK1-NEXT: store i32 0, ptr [[I]], align 4
218 // CHECK1-NEXT: [[TMP25:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
219 // CHECK1-NEXT: [[CMP23:%.*]] = icmp slt i32 0, [[TMP25]]
220 // CHECK1-NEXT: br i1 [[CMP23]], label [[OMP_PRECOND_THEN:%.*]], label [[OMP_PRECOND_END:%.*]]
221 // CHECK1: omp.precond.then:
222 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
223 // CHECK1-NEXT: [[TMP26:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_21]], align 4
224 // CHECK1-NEXT: store i32 [[TMP26]], ptr [[DOTOMP_UB]], align 4
225 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
226 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
227 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB6:[0-9]+]], i32 [[TMP0]], i32 34, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_LB]], ptr [[DOTOMP_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
228 // CHECK1-NEXT: [[TMP27:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
229 // CHECK1-NEXT: [[TMP28:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_21]], align 4
230 // CHECK1-NEXT: [[CMP25:%.*]] = icmp sgt i32 [[TMP27]], [[TMP28]]
231 // CHECK1-NEXT: br i1 [[CMP25]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
232 // CHECK1: cond.true:
233 // CHECK1-NEXT: [[TMP29:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_21]], align 4
234 // CHECK1-NEXT: br label [[COND_END:%.*]]
235 // CHECK1: cond.false:
236 // CHECK1-NEXT: [[TMP30:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
237 // CHECK1-NEXT: br label [[COND_END]]
238 // CHECK1: cond.end:
239 // CHECK1-NEXT: [[COND:%.*]] = phi i32 [ [[TMP29]], [[COND_TRUE]] ], [ [[TMP30]], [[COND_FALSE]] ]
240 // CHECK1-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
241 // CHECK1-NEXT: [[TMP31:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
242 // CHECK1-NEXT: store i32 [[TMP31]], ptr [[DOTOMP_IV]], align 4
243 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND26:%.*]]
244 // CHECK1: omp.inner.for.cond26:
245 // CHECK1-NEXT: [[TMP32:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
246 // CHECK1-NEXT: [[TMP33:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
247 // CHECK1-NEXT: [[CMP27:%.*]] = icmp sle i32 [[TMP32]], [[TMP33]]
248 // CHECK1-NEXT: br i1 [[CMP27]], label [[OMP_INNER_FOR_BODY28:%.*]], label [[OMP_INNER_FOR_END33:%.*]]
249 // CHECK1: omp.inner.for.body28:
250 // CHECK1-NEXT: [[TMP34:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
251 // CHECK1-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP34]], 1
252 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
253 // CHECK1-NEXT: store i32 [[ADD]], ptr [[I24]], align 4
254 // CHECK1-NEXT: [[TMP35:%.*]] = load float, ptr @flag, align 4
255 // CHECK1-NEXT: [[TOBOOL:%.*]] = fcmp une float [[TMP35]], 0.000000e+00
256 // CHECK1-NEXT: br i1 [[TOBOOL]], label [[OMP_IF_THEN:%.*]], label [[OMP_IF_ELSE:%.*]]
257 // CHECK1: omp_if.then:
258 // CHECK1-NEXT: [[TMP36:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[TMP0]], i32 2)
259 // CHECK1-NEXT: [[TMP37:%.*]] = icmp ne i32 [[TMP36]], 0
260 // CHECK1-NEXT: br i1 [[TMP37]], label [[DOTCANCEL_EXIT29:%.*]], label [[DOTCANCEL_CONTINUE30:%.*]]
261 // CHECK1: .cancel.exit29:
262 // CHECK1-NEXT: br label [[CANCEL_EXIT34:%.*]]
263 // CHECK1: cancel.exit19:
264 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB4]], i32 [[TMP0]])
265 // CHECK1-NEXT: br label [[CANCEL_CONT20]]
266 // CHECK1: .cancel.continue30:
267 // CHECK1-NEXT: br label [[OMP_IF_END:%.*]]
268 // CHECK1: omp_if.else:
269 // CHECK1-NEXT: br label [[OMP_IF_END]]
270 // CHECK1: omp_if.end:
271 // CHECK1-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
272 // CHECK1: omp.body.continue:
273 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC31:%.*]]
274 // CHECK1: omp.inner.for.inc31:
275 // CHECK1-NEXT: [[TMP38:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
276 // CHECK1-NEXT: [[ADD32:%.*]] = add nsw i32 [[TMP38]], 1
277 // CHECK1-NEXT: store i32 [[ADD32]], ptr [[DOTOMP_IV]], align 4
278 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND26]]
279 // CHECK1: omp.inner.for.end33:
280 // CHECK1-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
281 // CHECK1: omp.loop.exit:
282 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB6]], i32 [[TMP0]])
283 // CHECK1-NEXT: br label [[OMP_PRECOND_END]]
284 // CHECK1: cancel.exit34:
285 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB6]], i32 [[TMP0]])
286 // CHECK1-NEXT: br label [[CANCEL_CONT35:%.*]]
287 // CHECK1: omp.precond.end:
288 // CHECK1-NEXT: br label [[CANCEL_CONT35]]
289 // CHECK1: cancel.cont35:
290 // CHECK1-NEXT: call void @__kmpc_barrier(ptr @[[GLOB2:[0-9]+]], i32 [[TMP0]])
291 // CHECK1-NEXT: [[TMP39:%.*]] = call ptr @__kmpc_omp_task_alloc(ptr @[[GLOB1]], i32 [[TMP0]], i32 1, i64 40, i64 1, ptr @.omp_task_entry.)
292 // CHECK1-NEXT: [[TMP40:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_T_WITH_PRIVATES:%.*]], ptr [[TMP39]], i32 0, i32 0
293 // CHECK1-NEXT: [[TMP41:%.*]] = call i32 @__kmpc_omp_task(ptr @[[GLOB1]], i32 [[TMP0]], ptr [[TMP39]])
294 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB1]], i32 0, ptr @main.omp_outlined.1)
295 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB1]], i32 0, ptr @main.omp_outlined.2)
296 // CHECK1-NEXT: store i32 0, ptr [[R]], align 4
297 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB1]], i32 2, ptr @main.omp_outlined.3, ptr [[ARGC_ADDR]], ptr [[R]])
298 // CHECK1-NEXT: [[TMP42:%.*]] = load i32, ptr [[ARGC_ADDR]], align 4
299 // CHECK1-NEXT: ret i32 [[TMP42]]
302 // CHECK1-LABEL: define {{[^@]+}}@main.omp_outlined
303 // 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]+]] {
304 // CHECK1-NEXT: entry:
305 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
306 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
307 // CHECK1-NEXT: [[ARGV_ADDR:%.*]] = alloca ptr, align 8
308 // CHECK1-NEXT: [[ARGC_ADDR:%.*]] = alloca ptr, align 8
309 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
310 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
311 // CHECK1-NEXT: store ptr [[ARGV]], ptr [[ARGV_ADDR]], align 8
312 // CHECK1-NEXT: store ptr [[ARGC]], ptr [[ARGC_ADDR]], align 8
313 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[ARGV_ADDR]], align 8
314 // CHECK1-NEXT: [[TMP1:%.*]] = load ptr, ptr [[ARGC_ADDR]], align 8
315 // CHECK1-NEXT: [[TMP2:%.*]] = load float, ptr @flag, align 4
316 // CHECK1-NEXT: [[TOBOOL:%.*]] = fcmp une float [[TMP2]], 0.000000e+00
317 // CHECK1-NEXT: br i1 [[TOBOOL]], label [[OMP_IF_THEN:%.*]], label [[OMP_IF_ELSE:%.*]]
318 // CHECK1: omp_if.then:
319 // CHECK1-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
320 // CHECK1-NEXT: [[TMP4:%.*]] = load i32, ptr [[TMP3]], align 4
321 // CHECK1-NEXT: [[TMP5:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[TMP4]], i32 1)
322 // CHECK1-NEXT: [[TMP6:%.*]] = icmp ne i32 [[TMP5]], 0
323 // CHECK1-NEXT: br i1 [[TMP6]], label [[DOTCANCEL_EXIT:%.*]], label [[DOTCANCEL_CONTINUE:%.*]]
324 // CHECK1: .cancel.exit:
325 // CHECK1-NEXT: [[TMP7:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
326 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
327 // CHECK1-NEXT: [[TMP9:%.*]] = call i32 @__kmpc_cancel_barrier(ptr @[[GLOB2]], i32 [[TMP8]])
328 // CHECK1-NEXT: br label [[RETURN:%.*]]
329 // CHECK1: .cancel.continue:
330 // CHECK1-NEXT: br label [[OMP_IF_END:%.*]]
331 // CHECK1: omp_if.else:
332 // CHECK1-NEXT: br label [[OMP_IF_END]]
333 // CHECK1: omp_if.end:
334 // CHECK1-NEXT: [[TMP10:%.*]] = load i32, ptr [[TMP1]], align 4
335 // CHECK1-NEXT: [[CONV:%.*]] = trunc i32 [[TMP10]] to i8
336 // CHECK1-NEXT: [[TMP11:%.*]] = load ptr, ptr [[TMP0]], align 8
337 // CHECK1-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds ptr, ptr [[TMP11]], i64 0
338 // CHECK1-NEXT: [[TMP12:%.*]] = load ptr, ptr [[ARRAYIDX]], align 8
339 // CHECK1-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds i8, ptr [[TMP12]], i64 0
340 // CHECK1-NEXT: store i8 [[CONV]], ptr [[ARRAYIDX1]], align 1
341 // CHECK1-NEXT: [[TMP13:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
342 // CHECK1-NEXT: [[TMP14:%.*]] = load i32, ptr [[TMP13]], align 4
343 // CHECK1-NEXT: [[TMP15:%.*]] = call i32 @__kmpc_cancel_barrier(ptr @[[GLOB3:[0-9]+]], i32 [[TMP14]])
344 // CHECK1-NEXT: [[TMP16:%.*]] = icmp ne i32 [[TMP15]], 0
345 // CHECK1-NEXT: br i1 [[TMP16]], label [[DOTCANCEL_EXIT2:%.*]], label [[DOTCANCEL_CONTINUE3:%.*]]
346 // CHECK1: .cancel.exit2:
347 // CHECK1-NEXT: br label [[RETURN]]
348 // CHECK1: .cancel.continue3:
349 // CHECK1-NEXT: [[TMP17:%.*]] = load i32, ptr [[TMP1]], align 4
350 // CHECK1-NEXT: [[TMP18:%.*]] = load ptr, ptr [[TMP0]], align 8
351 // CHECK1-NEXT: [[ARRAYIDX4:%.*]] = getelementptr inbounds ptr, ptr [[TMP18]], i64 0
352 // CHECK1-NEXT: [[TMP19:%.*]] = load ptr, ptr [[ARRAYIDX4]], align 8
353 // CHECK1-NEXT: [[ARRAYIDX5:%.*]] = getelementptr inbounds i8, ptr [[TMP19]], i64 0
354 // CHECK1-NEXT: [[TMP20:%.*]] = load i8, ptr [[ARRAYIDX5]], align 1
355 // CHECK1-NEXT: [[CONV6:%.*]] = sext i8 [[TMP20]] to i32
356 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[CONV6]], [[TMP17]]
357 // CHECK1-NEXT: [[CONV7:%.*]] = trunc i32 [[ADD]] to i8
358 // CHECK1-NEXT: store i8 [[CONV7]], ptr [[ARRAYIDX5]], align 1
359 // CHECK1-NEXT: br label [[RETURN]]
360 // CHECK1: return:
361 // CHECK1-NEXT: ret void
364 // CHECK1-LABEL: define {{[^@]+}}@.omp_task_entry.
365 // CHECK1-SAME: (i32 noundef [[TMP0:%.*]], ptr noalias noundef [[TMP1:%.*]]) #[[ATTR4:[0-9]+]] {
366 // CHECK1-NEXT: entry:
367 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR_I:%.*]] = alloca i32, align 4
368 // CHECK1-NEXT: [[DOTPART_ID__ADDR_I:%.*]] = alloca ptr, align 8
369 // CHECK1-NEXT: [[DOTPRIVATES__ADDR_I:%.*]] = alloca ptr, align 8
370 // CHECK1-NEXT: [[DOTCOPY_FN__ADDR_I:%.*]] = alloca ptr, align 8
371 // CHECK1-NEXT: [[DOTTASK_T__ADDR_I:%.*]] = alloca ptr, align 8
372 // CHECK1-NEXT: [[__CONTEXT_ADDR_I:%.*]] = alloca ptr, align 8
373 // CHECK1-NEXT: [[CLEANUP_DEST_SLOT_I:%.*]] = alloca i32, align 4
374 // CHECK1-NEXT: [[DOTADDR:%.*]] = alloca i32, align 4
375 // CHECK1-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 8
376 // CHECK1-NEXT: store i32 [[TMP0]], ptr [[DOTADDR]], align 4
377 // CHECK1-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 8
378 // CHECK1-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTADDR]], align 4
379 // CHECK1-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 8
380 // CHECK1-NEXT: [[TMP4:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_T_WITH_PRIVATES:%.*]], ptr [[TMP3]], i32 0, i32 0
381 // CHECK1-NEXT: [[TMP5:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_T:%.*]], ptr [[TMP4]], i32 0, i32 2
382 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_T]], ptr [[TMP4]], i32 0, i32 0
383 // CHECK1-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 8
384 // CHECK1-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META5:![0-9]+]])
385 // CHECK1-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META8:![0-9]+]])
386 // CHECK1-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META10:![0-9]+]])
387 // CHECK1-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META12:![0-9]+]])
388 // CHECK1-NEXT: store i32 [[TMP2]], ptr [[DOTGLOBAL_TID__ADDR_I]], align 4, !noalias !14
389 // CHECK1-NEXT: store ptr [[TMP5]], ptr [[DOTPART_ID__ADDR_I]], align 8, !noalias !14
390 // CHECK1-NEXT: store ptr null, ptr [[DOTPRIVATES__ADDR_I]], align 8, !noalias !14
391 // CHECK1-NEXT: store ptr null, ptr [[DOTCOPY_FN__ADDR_I]], align 8, !noalias !14
392 // CHECK1-NEXT: store ptr [[TMP3]], ptr [[DOTTASK_T__ADDR_I]], align 8, !noalias !14
393 // CHECK1-NEXT: store ptr [[TMP7]], ptr [[__CONTEXT_ADDR_I]], align 8, !noalias !14
394 // CHECK1-NEXT: [[TMP8:%.*]] = load ptr, ptr [[__CONTEXT_ADDR_I]], align 8, !noalias !14
395 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTGLOBAL_TID__ADDR_I]], align 4, !noalias !14
396 // CHECK1-NEXT: [[TMP10:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[TMP9]], i32 4)
397 // CHECK1-NEXT: [[TMP11:%.*]] = icmp ne i32 [[TMP10]], 0
398 // CHECK1-NEXT: br i1 [[TMP11]], label [[DOTCANCEL_EXIT_I:%.*]], label [[DOTCANCEL_CONTINUE_I:%.*]]
399 // CHECK1: .cancel.exit.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.continue.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 {{[^@]+}}@main.omp_outlined.1
411 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]]) #[[ATTR1]] {
412 // CHECK1-NEXT: entry:
413 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
414 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
415 // CHECK1-NEXT: [[DOTOMP_SECTIONS_LB_:%.*]] = alloca i32, align 4
416 // CHECK1-NEXT: [[DOTOMP_SECTIONS_UB_:%.*]] = alloca i32, align 4
417 // CHECK1-NEXT: [[DOTOMP_SECTIONS_ST_:%.*]] = alloca i32, align 4
418 // CHECK1-NEXT: [[DOTOMP_SECTIONS_IL_:%.*]] = alloca i32, align 4
419 // CHECK1-NEXT: [[DOTOMP_SECTIONS_IV_:%.*]] = alloca i32, align 4
420 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
421 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
422 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_LB_]], align 4
423 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_UB_]], align 4
424 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_SECTIONS_ST_]], align 4
425 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_IL_]], align 4
426 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
427 // CHECK1-NEXT: [[TMP1:%.*]] = load i32, ptr [[TMP0]], align 4
428 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB4]], i32 [[TMP1]], i32 34, ptr [[DOTOMP_SECTIONS_IL_]], ptr [[DOTOMP_SECTIONS_LB_]], ptr [[DOTOMP_SECTIONS_UB_]], ptr [[DOTOMP_SECTIONS_ST_]], i32 1, i32 1)
429 // CHECK1-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_]], align 4
430 // CHECK1-NEXT: [[TMP3:%.*]] = icmp slt i32 [[TMP2]], 0
431 // CHECK1-NEXT: [[TMP4:%.*]] = select i1 [[TMP3]], i32 [[TMP2]], i32 0
432 // CHECK1-NEXT: store i32 [[TMP4]], ptr [[DOTOMP_SECTIONS_UB_]], align 4
433 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_LB_]], align 4
434 // CHECK1-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_SECTIONS_IV_]], align 4
435 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
436 // CHECK1: omp.inner.for.cond:
437 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
438 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_]], align 4
439 // CHECK1-NEXT: [[CMP:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
440 // CHECK1-NEXT: br i1 [[CMP]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
441 // CHECK1: omp.inner.for.body:
442 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
443 // CHECK1-NEXT: switch i32 [[TMP8]], label [[DOTOMP_SECTIONS_EXIT:%.*]] [
444 // CHECK1-NEXT: i32 0, label [[DOTOMP_SECTIONS_CASE:%.*]]
445 // CHECK1-NEXT: ]
446 // CHECK1: .omp.sections.case:
447 // CHECK1-NEXT: [[TMP9:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[TMP1]], i32 3)
448 // CHECK1-NEXT: [[TMP10:%.*]] = icmp ne i32 [[TMP9]], 0
449 // CHECK1-NEXT: br i1 [[TMP10]], label [[DOTCANCEL_EXIT:%.*]], label [[DOTCANCEL_CONTINUE:%.*]]
450 // CHECK1: .cancel.exit:
451 // CHECK1-NEXT: br label [[CANCEL_EXIT:%.*]]
452 // CHECK1: .cancel.continue:
453 // CHECK1-NEXT: br label [[DOTOMP_SECTIONS_EXIT]]
454 // CHECK1: .omp.sections.exit:
455 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
456 // CHECK1: omp.inner.for.inc:
457 // CHECK1-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
458 // CHECK1-NEXT: [[INC:%.*]] = add nsw i32 [[TMP11]], 1
459 // CHECK1-NEXT: store i32 [[INC]], ptr [[DOTOMP_SECTIONS_IV_]], align 4
460 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]]
461 // CHECK1: omp.inner.for.end:
462 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB4]], i32 [[TMP1]])
463 // CHECK1-NEXT: br label [[CANCEL_CONT:%.*]]
464 // CHECK1: cancel.cont:
465 // CHECK1-NEXT: ret void
466 // CHECK1: cancel.exit:
467 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB4]], i32 [[TMP1]])
468 // CHECK1-NEXT: br label [[CANCEL_CONT]]
471 // CHECK1-LABEL: define {{[^@]+}}@main.omp_outlined.2
472 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]]) #[[ATTR1]] {
473 // CHECK1-NEXT: entry:
474 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
475 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
476 // CHECK1-NEXT: [[DOTOMP_SECTIONS_LB_:%.*]] = alloca i32, align 4
477 // CHECK1-NEXT: [[DOTOMP_SECTIONS_UB_:%.*]] = alloca i32, align 4
478 // CHECK1-NEXT: [[DOTOMP_SECTIONS_ST_:%.*]] = alloca i32, align 4
479 // CHECK1-NEXT: [[DOTOMP_SECTIONS_IL_:%.*]] = alloca i32, align 4
480 // CHECK1-NEXT: [[DOTOMP_SECTIONS_IV_:%.*]] = alloca i32, align 4
481 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
482 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
483 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_LB_]], align 4
484 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_SECTIONS_UB_]], align 4
485 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_SECTIONS_ST_]], align 4
486 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_IL_]], align 4
487 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
488 // CHECK1-NEXT: [[TMP1:%.*]] = load i32, ptr [[TMP0]], align 4
489 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB4]], i32 [[TMP1]], i32 34, ptr [[DOTOMP_SECTIONS_IL_]], ptr [[DOTOMP_SECTIONS_LB_]], ptr [[DOTOMP_SECTIONS_UB_]], ptr [[DOTOMP_SECTIONS_ST_]], i32 1, i32 1)
490 // CHECK1-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_]], align 4
491 // CHECK1-NEXT: [[TMP3:%.*]] = icmp slt i32 [[TMP2]], 1
492 // CHECK1-NEXT: [[TMP4:%.*]] = select i1 [[TMP3]], i32 [[TMP2]], i32 1
493 // CHECK1-NEXT: store i32 [[TMP4]], ptr [[DOTOMP_SECTIONS_UB_]], align 4
494 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_LB_]], align 4
495 // CHECK1-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_SECTIONS_IV_]], align 4
496 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
497 // CHECK1: omp.inner.for.cond:
498 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
499 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_]], align 4
500 // CHECK1-NEXT: [[CMP:%.*]] = icmp sle i32 [[TMP6]], [[TMP7]]
501 // CHECK1-NEXT: br i1 [[CMP]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
502 // CHECK1: omp.inner.for.body:
503 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
504 // CHECK1-NEXT: switch i32 [[TMP8]], label [[DOTOMP_SECTIONS_EXIT:%.*]] [
505 // CHECK1-NEXT: i32 0, label [[DOTOMP_SECTIONS_CASE:%.*]]
506 // CHECK1-NEXT: i32 1, label [[DOTOMP_SECTIONS_CASE1:%.*]]
507 // CHECK1-NEXT: ]
508 // CHECK1: .omp.sections.case:
509 // CHECK1-NEXT: [[TMP9:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[TMP1]], i32 3)
510 // CHECK1-NEXT: [[TMP10:%.*]] = icmp ne i32 [[TMP9]], 0
511 // CHECK1-NEXT: br i1 [[TMP10]], label [[DOTCANCEL_EXIT:%.*]], label [[DOTCANCEL_CONTINUE:%.*]]
512 // CHECK1: .cancel.exit:
513 // CHECK1-NEXT: br label [[CANCEL_EXIT:%.*]]
514 // CHECK1: .cancel.continue:
515 // CHECK1-NEXT: br label [[DOTOMP_SECTIONS_EXIT]]
516 // CHECK1: .omp.sections.case1:
517 // CHECK1-NEXT: [[TMP11:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[TMP1]], i32 3)
518 // CHECK1-NEXT: [[TMP12:%.*]] = icmp ne i32 [[TMP11]], 0
519 // CHECK1-NEXT: br i1 [[TMP12]], label [[DOTCANCEL_EXIT2:%.*]], label [[DOTCANCEL_CONTINUE3:%.*]]
520 // CHECK1: .cancel.exit2:
521 // CHECK1-NEXT: br label [[CANCEL_EXIT]]
522 // CHECK1: .cancel.continue3:
523 // CHECK1-NEXT: br label [[DOTOMP_SECTIONS_EXIT]]
524 // CHECK1: .omp.sections.exit:
525 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
526 // CHECK1: omp.inner.for.inc:
527 // CHECK1-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
528 // CHECK1-NEXT: [[INC:%.*]] = add nsw i32 [[TMP13]], 1
529 // CHECK1-NEXT: store i32 [[INC]], ptr [[DOTOMP_SECTIONS_IV_]], align 4
530 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]]
531 // CHECK1: omp.inner.for.end:
532 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB4]], i32 [[TMP1]])
533 // CHECK1-NEXT: br label [[CANCEL_CONT:%.*]]
534 // CHECK1: cancel.cont:
535 // CHECK1-NEXT: ret void
536 // CHECK1: cancel.exit:
537 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB4]], i32 [[TMP1]])
538 // CHECK1-NEXT: br label [[CANCEL_CONT]]
541 // CHECK1-LABEL: define {{[^@]+}}@main.omp_outlined.3
542 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[ARGC:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[R:%.*]]) #[[ATTR1]] {
543 // CHECK1-NEXT: entry:
544 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
545 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
546 // CHECK1-NEXT: [[ARGC_ADDR:%.*]] = alloca ptr, align 8
547 // CHECK1-NEXT: [[R_ADDR:%.*]] = alloca ptr, align 8
548 // CHECK1-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
549 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
550 // CHECK1-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
551 // CHECK1-NEXT: [[DOTCAPTURE_EXPR_1:%.*]] = alloca i32, align 4
552 // CHECK1-NEXT: [[I:%.*]] = alloca i32, align 4
553 // CHECK1-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
554 // CHECK1-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
555 // CHECK1-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
556 // CHECK1-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
557 // CHECK1-NEXT: [[R3:%.*]] = alloca i32, align 4
558 // CHECK1-NEXT: [[I4:%.*]] = alloca i32, align 4
559 // CHECK1-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 8
560 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
561 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
562 // CHECK1-NEXT: store ptr [[ARGC]], ptr [[ARGC_ADDR]], align 8
563 // CHECK1-NEXT: store ptr [[R]], ptr [[R_ADDR]], align 8
564 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[ARGC_ADDR]], align 8
565 // CHECK1-NEXT: [[TMP1:%.*]] = load ptr, ptr [[R_ADDR]], align 8
566 // CHECK1-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP0]], align 4
567 // CHECK1-NEXT: store i32 [[TMP2]], ptr [[DOTCAPTURE_EXPR_]], align 4
568 // CHECK1-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
569 // CHECK1-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP3]], 0
570 // CHECK1-NEXT: [[DIV:%.*]] = sdiv i32 [[SUB]], 1
571 // CHECK1-NEXT: [[SUB2:%.*]] = sub nsw i32 [[DIV]], 1
572 // CHECK1-NEXT: store i32 [[SUB2]], ptr [[DOTCAPTURE_EXPR_1]], align 4
573 // CHECK1-NEXT: store i32 0, ptr [[I]], align 4
574 // CHECK1-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
575 // CHECK1-NEXT: [[CMP:%.*]] = icmp slt i32 0, [[TMP4]]
576 // CHECK1-NEXT: br i1 [[CMP]], label [[OMP_PRECOND_THEN:%.*]], label [[OMP_PRECOND_END:%.*]]
577 // CHECK1: omp.precond.then:
578 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
579 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
580 // CHECK1-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_UB]], align 4
581 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
582 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
583 // CHECK1-NEXT: store i32 0, ptr [[R3]], align 4
584 // CHECK1-NEXT: [[TMP6:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
585 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[TMP6]], align 4
586 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB6]], i32 [[TMP7]], i32 34, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_LB]], ptr [[DOTOMP_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
587 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
588 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
589 // CHECK1-NEXT: [[CMP5:%.*]] = icmp sgt i32 [[TMP8]], [[TMP9]]
590 // CHECK1-NEXT: br i1 [[CMP5]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
591 // CHECK1: cond.true:
592 // CHECK1-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
593 // CHECK1-NEXT: br label [[COND_END:%.*]]
594 // CHECK1: cond.false:
595 // CHECK1-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
596 // CHECK1-NEXT: br label [[COND_END]]
597 // CHECK1: cond.end:
598 // CHECK1-NEXT: [[COND:%.*]] = phi i32 [ [[TMP10]], [[COND_TRUE]] ], [ [[TMP11]], [[COND_FALSE]] ]
599 // CHECK1-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
600 // CHECK1-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
601 // CHECK1-NEXT: store i32 [[TMP12]], ptr [[DOTOMP_IV]], align 4
602 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
603 // CHECK1: omp.inner.for.cond:
604 // CHECK1-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
605 // CHECK1-NEXT: [[TMP14:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
606 // CHECK1-NEXT: [[CMP6:%.*]] = icmp sle i32 [[TMP13]], [[TMP14]]
607 // CHECK1-NEXT: br i1 [[CMP6]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
608 // CHECK1: omp.inner.for.body:
609 // CHECK1-NEXT: [[TMP15:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
610 // CHECK1-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP15]], 1
611 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
612 // CHECK1-NEXT: store i32 [[ADD]], ptr [[I4]], align 4
613 // CHECK1-NEXT: [[TMP16:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
614 // CHECK1-NEXT: [[TMP17:%.*]] = load i32, ptr [[TMP16]], align 4
615 // CHECK1-NEXT: [[TMP18:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[TMP17]], i32 2)
616 // CHECK1-NEXT: [[TMP19:%.*]] = icmp ne i32 [[TMP18]], 0
617 // CHECK1-NEXT: br i1 [[TMP19]], label [[DOTCANCEL_EXIT:%.*]], label [[DOTCANCEL_CONTINUE:%.*]]
618 // CHECK1: .cancel.exit:
619 // CHECK1-NEXT: br label [[CANCEL_EXIT:%.*]]
620 // CHECK1: .cancel.continue:
621 // CHECK1-NEXT: [[TMP20:%.*]] = load i32, ptr [[I4]], align 4
622 // CHECK1-NEXT: [[TMP21:%.*]] = load i32, ptr [[R3]], align 4
623 // CHECK1-NEXT: [[ADD7:%.*]] = add nsw i32 [[TMP21]], [[TMP20]]
624 // CHECK1-NEXT: store i32 [[ADD7]], ptr [[R3]], align 4
625 // CHECK1-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
626 // CHECK1: omp.body.continue:
627 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
628 // CHECK1: omp.inner.for.inc:
629 // CHECK1-NEXT: [[TMP22:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
630 // CHECK1-NEXT: [[ADD8:%.*]] = add nsw i32 [[TMP22]], 1
631 // CHECK1-NEXT: store i32 [[ADD8]], ptr [[DOTOMP_IV]], align 4
632 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]]
633 // CHECK1: omp.inner.for.end:
634 // CHECK1-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
635 // CHECK1: omp.loop.exit:
636 // CHECK1-NEXT: [[TMP23:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
637 // CHECK1-NEXT: [[TMP24:%.*]] = load i32, ptr [[TMP23]], align 4
638 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB6]], i32 [[TMP24]])
639 // CHECK1-NEXT: [[TMP25:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i64 0, i64 0
640 // CHECK1-NEXT: store ptr [[R3]], ptr [[TMP25]], align 8
641 // CHECK1-NEXT: [[TMP26:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
642 // CHECK1-NEXT: [[TMP27:%.*]] = load i32, ptr [[TMP26]], align 4
643 // CHECK1-NEXT: [[TMP28:%.*]] = call i32 @__kmpc_reduce_nowait(ptr @[[GLOB7:[0-9]+]], i32 [[TMP27]], i32 1, i64 8, ptr [[DOTOMP_REDUCTION_RED_LIST]], ptr @main.omp_outlined.3.omp.reduction.reduction_func, ptr @.gomp_critical_user_.reduction.var)
644 // CHECK1-NEXT: switch i32 [[TMP28]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
645 // CHECK1-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
646 // CHECK1-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
647 // CHECK1-NEXT: ]
648 // CHECK1: .omp.reduction.case1:
649 // CHECK1-NEXT: [[TMP29:%.*]] = load i32, ptr [[TMP1]], align 4
650 // CHECK1-NEXT: [[TMP30:%.*]] = load i32, ptr [[R3]], align 4
651 // CHECK1-NEXT: [[ADD9:%.*]] = add nsw i32 [[TMP29]], [[TMP30]]
652 // CHECK1-NEXT: store i32 [[ADD9]], ptr [[TMP1]], align 4
653 // CHECK1-NEXT: call void @__kmpc_end_reduce_nowait(ptr @[[GLOB7]], i32 [[TMP27]], ptr @.gomp_critical_user_.reduction.var)
654 // CHECK1-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
655 // CHECK1: cancel.exit:
656 // CHECK1-NEXT: [[TMP31:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
657 // CHECK1-NEXT: [[TMP32:%.*]] = load i32, ptr [[TMP31]], align 4
658 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB6]], i32 [[TMP32]])
659 // CHECK1-NEXT: br label [[CANCEL_CONT:%.*]]
660 // CHECK1: .omp.reduction.case2:
661 // CHECK1-NEXT: [[TMP33:%.*]] = load i32, ptr [[R3]], align 4
662 // CHECK1-NEXT: [[TMP34:%.*]] = atomicrmw add ptr [[TMP1]], i32 [[TMP33]] monotonic, align 4
663 // CHECK1-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
664 // CHECK1: .omp.reduction.default:
665 // CHECK1-NEXT: br label [[OMP_PRECOND_END]]
666 // CHECK1: omp.precond.end:
667 // CHECK1-NEXT: br label [[CANCEL_CONT]]
668 // CHECK1: cancel.cont:
669 // CHECK1-NEXT: ret void
672 // CHECK1-LABEL: define {{[^@]+}}@main.omp_outlined.3.omp.reduction.reduction_func
673 // CHECK1-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR4]] {
674 // CHECK1-NEXT: entry:
675 // CHECK1-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 8
676 // CHECK1-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 8
677 // CHECK1-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 8
678 // CHECK1-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 8
679 // CHECK1-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 8
680 // CHECK1-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 8
681 // CHECK1-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i64 0, i64 0
682 // CHECK1-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 8
683 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i64 0, i64 0
684 // CHECK1-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 8
685 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
686 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
687 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
688 // CHECK1-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
689 // CHECK1-NEXT: ret void
692 // CHECK3-LABEL: define {{[^@]+}}@main
693 // CHECK3-SAME: (i32 noundef [[ARGC:%.*]], ptr noundef [[ARGV:%.*]]) #[[ATTR0:[0-9]+]] {
694 // CHECK3-NEXT: entry:
695 // CHECK3-NEXT: [[STRUCTARG:%.*]] = alloca { ptr, ptr }, align 8
696 // CHECK3-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
697 // CHECK3-NEXT: [[ARGC_ADDR:%.*]] = alloca i32, align 4
698 // CHECK3-NEXT: [[ARGV_ADDR:%.*]] = alloca ptr, align 8
699 // CHECK3-NEXT: [[P_LASTITER:%.*]] = alloca i32, align 4
700 // CHECK3-NEXT: [[P_LOWERBOUND:%.*]] = alloca i32, align 4
701 // CHECK3-NEXT: [[P_UPPERBOUND:%.*]] = alloca i32, align 4
702 // CHECK3-NEXT: [[P_STRIDE:%.*]] = alloca i32, align 4
703 // CHECK3-NEXT: [[P_LASTITER28:%.*]] = alloca i32, align 4
704 // CHECK3-NEXT: [[P_LOWERBOUND29:%.*]] = alloca i32, align 4
705 // CHECK3-NEXT: [[P_UPPERBOUND30:%.*]] = alloca i32, align 4
706 // CHECK3-NEXT: [[P_STRIDE31:%.*]] = alloca i32, align 4
707 // CHECK3-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
708 // CHECK3-NEXT: [[TMP:%.*]] = alloca i32, align 4
709 // CHECK3-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
710 // CHECK3-NEXT: [[DOTCAPTURE_EXPR_34:%.*]] = alloca i32, align 4
711 // CHECK3-NEXT: [[I:%.*]] = alloca i32, align 4
712 // CHECK3-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
713 // CHECK3-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
714 // CHECK3-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
715 // CHECK3-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
716 // CHECK3-NEXT: [[I36:%.*]] = alloca i32, align 4
717 // CHECK3-NEXT: [[AGG_CAPTURED:%.*]] = alloca [[STRUCT_ANON:%.*]], align 1
718 // CHECK3-NEXT: [[R:%.*]] = alloca i32, align 4
719 // CHECK3-NEXT: store i32 0, ptr [[RETVAL]], align 4
720 // CHECK3-NEXT: store i32 [[ARGC]], ptr [[ARGC_ADDR]], align 4
721 // CHECK3-NEXT: store ptr [[ARGV]], ptr [[ARGV_ADDR]], align 8
722 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1:[0-9]+]])
723 // CHECK3-NEXT: br label [[OMP_PARALLEL:%.*]]
724 // CHECK3: omp_parallel:
725 // CHECK3-NEXT: [[GEP_ARGC_ADDR:%.*]] = getelementptr { ptr, ptr }, ptr [[STRUCTARG]], i32 0, i32 0
726 // CHECK3-NEXT: store ptr [[ARGC_ADDR]], ptr [[GEP_ARGC_ADDR]], align 8
727 // CHECK3-NEXT: [[GEP_ARGV_ADDR:%.*]] = getelementptr { ptr, ptr }, ptr [[STRUCTARG]], i32 0, i32 1
728 // CHECK3-NEXT: store ptr [[ARGV_ADDR]], ptr [[GEP_ARGV_ADDR]], align 8
729 // CHECK3-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB1]], i32 1, ptr @main..omp_par, ptr [[STRUCTARG]])
730 // CHECK3-NEXT: br label [[OMP_PAR_OUTLINED_EXIT:%.*]]
731 // CHECK3: omp.par.outlined.exit:
732 // CHECK3-NEXT: br label [[OMP_PAR_EXIT_SPLIT:%.*]]
733 // CHECK3: omp.par.exit.split:
734 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_PREHEADER:%.*]]
735 // CHECK3: omp_section_loop.preheader:
736 // CHECK3-NEXT: store i32 0, ptr [[P_LOWERBOUND]], align 4
737 // CHECK3-NEXT: store i32 0, ptr [[P_UPPERBOUND]], align 4
738 // CHECK3-NEXT: store i32 1, ptr [[P_STRIDE]], align 4
739 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM11:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1]])
740 // CHECK3-NEXT: call void @__kmpc_for_static_init_4u(ptr @[[GLOB1]], i32 [[OMP_GLOBAL_THREAD_NUM11]], i32 34, ptr [[P_LASTITER]], ptr [[P_LOWERBOUND]], ptr [[P_UPPERBOUND]], ptr [[P_STRIDE]], i32 1, i32 0)
741 // CHECK3-NEXT: [[TMP0:%.*]] = load i32, ptr [[P_LOWERBOUND]], align 4
742 // CHECK3-NEXT: [[TMP1:%.*]] = load i32, ptr [[P_UPPERBOUND]], align 4
743 // CHECK3-NEXT: [[TMP2:%.*]] = sub i32 [[TMP1]], [[TMP0]]
744 // CHECK3-NEXT: [[TMP3:%.*]] = add i32 [[TMP2]], 1
745 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_HEADER:%.*]]
746 // CHECK3: omp_section_loop.header:
747 // CHECK3-NEXT: [[OMP_SECTION_LOOP_IV:%.*]] = phi i32 [ 0, [[OMP_SECTION_LOOP_PREHEADER]] ], [ [[OMP_SECTION_LOOP_NEXT:%.*]], [[OMP_SECTION_LOOP_INC:%.*]] ]
748 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_COND:%.*]]
749 // CHECK3: omp_section_loop.cond:
750 // CHECK3-NEXT: [[OMP_SECTION_LOOP_CMP:%.*]] = icmp ult i32 [[OMP_SECTION_LOOP_IV]], [[TMP3]]
751 // CHECK3-NEXT: br i1 [[OMP_SECTION_LOOP_CMP]], label [[OMP_SECTION_LOOP_BODY:%.*]], label [[OMP_SECTION_LOOP_EXIT:%.*]]
752 // CHECK3: omp_section_loop.body:
753 // CHECK3-NEXT: [[TMP4:%.*]] = add i32 [[OMP_SECTION_LOOP_IV]], [[TMP0]]
754 // CHECK3-NEXT: [[TMP5:%.*]] = mul i32 [[TMP4]], 1
755 // CHECK3-NEXT: [[TMP6:%.*]] = add i32 [[TMP5]], 0
756 // CHECK3-NEXT: switch i32 [[TMP6]], label [[OMP_SECTION_LOOP_BODY_SECTIONS_AFTER:%.*]] [
757 // CHECK3-NEXT: i32 0, label [[OMP_SECTION_LOOP_BODY_CASE:%.*]]
758 // CHECK3-NEXT: ]
759 // CHECK3: omp_section_loop.body.case:
760 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM10:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1]])
761 // CHECK3-NEXT: [[TMP7:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[OMP_GLOBAL_THREAD_NUM10]], i32 3)
762 // CHECK3-NEXT: [[TMP8:%.*]] = icmp eq i32 [[TMP7]], 0
763 // CHECK3-NEXT: br i1 [[TMP8]], label [[OMP_SECTION_LOOP_BODY_CASE_SPLIT:%.*]], label [[OMP_SECTION_LOOP_BODY_CASE_CNCL:%.*]]
764 // CHECK3: omp_section_loop.body.case.split:
765 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_BODY_CASE_SECTION_AFTER:%.*]]
766 // CHECK3: omp_section_loop.body.case.section.after:
767 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_BODY_SECTIONS_AFTER]]
768 // CHECK3: omp_section_loop.body.sections.after:
769 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_INC]]
770 // CHECK3: omp_section_loop.inc:
771 // CHECK3-NEXT: [[OMP_SECTION_LOOP_NEXT]] = add nuw i32 [[OMP_SECTION_LOOP_IV]], 1
772 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_HEADER]]
773 // CHECK3: omp_section_loop.exit:
774 // CHECK3-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[OMP_GLOBAL_THREAD_NUM11]])
775 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM12:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1]])
776 // CHECK3-NEXT: call void @__kmpc_barrier(ptr @[[GLOB2:[0-9]+]], i32 [[OMP_GLOBAL_THREAD_NUM12]])
777 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_AFTER:%.*]]
778 // CHECK3: omp_section_loop.after:
779 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_AFTERSECTIONS_FINI:%.*]]
780 // CHECK3: omp_section_loop.aftersections.fini:
781 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_PREHEADER13:%.*]]
782 // CHECK3: omp_section_loop.preheader13:
783 // CHECK3-NEXT: store i32 0, ptr [[P_LOWERBOUND29]], align 4
784 // CHECK3-NEXT: store i32 1, ptr [[P_UPPERBOUND30]], align 4
785 // CHECK3-NEXT: store i32 1, ptr [[P_STRIDE31]], align 4
786 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM32:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1]])
787 // CHECK3-NEXT: call void @__kmpc_for_static_init_4u(ptr @[[GLOB1]], i32 [[OMP_GLOBAL_THREAD_NUM32]], i32 34, ptr [[P_LASTITER28]], ptr [[P_LOWERBOUND29]], ptr [[P_UPPERBOUND30]], ptr [[P_STRIDE31]], i32 1, i32 0)
788 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[P_LOWERBOUND29]], align 4
789 // CHECK3-NEXT: [[TMP10:%.*]] = load i32, ptr [[P_UPPERBOUND30]], align 4
790 // CHECK3-NEXT: [[TMP11:%.*]] = sub i32 [[TMP10]], [[TMP9]]
791 // CHECK3-NEXT: [[TMP12:%.*]] = add i32 [[TMP11]], 1
792 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_HEADER14:%.*]]
793 // CHECK3: omp_section_loop.header14:
794 // CHECK3-NEXT: [[OMP_SECTION_LOOP_IV20:%.*]] = phi i32 [ 0, [[OMP_SECTION_LOOP_PREHEADER13]] ], [ [[OMP_SECTION_LOOP_NEXT22:%.*]], [[OMP_SECTION_LOOP_INC17:%.*]] ]
795 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_COND15:%.*]]
796 // CHECK3: omp_section_loop.cond15:
797 // CHECK3-NEXT: [[OMP_SECTION_LOOP_CMP21:%.*]] = icmp ult i32 [[OMP_SECTION_LOOP_IV20]], [[TMP12]]
798 // CHECK3-NEXT: br i1 [[OMP_SECTION_LOOP_CMP21]], label [[OMP_SECTION_LOOP_BODY16:%.*]], label [[OMP_SECTION_LOOP_EXIT18:%.*]]
799 // CHECK3: omp_section_loop.body16:
800 // CHECK3-NEXT: [[TMP13:%.*]] = add i32 [[OMP_SECTION_LOOP_IV20]], [[TMP9]]
801 // CHECK3-NEXT: [[TMP14:%.*]] = mul i32 [[TMP13]], 1
802 // CHECK3-NEXT: [[TMP15:%.*]] = add i32 [[TMP14]], 0
803 // CHECK3-NEXT: switch i32 [[TMP15]], label [[OMP_SECTION_LOOP_BODY16_SECTIONS_AFTER:%.*]] [
804 // CHECK3-NEXT: i32 0, label [[OMP_SECTION_LOOP_BODY_CASE23:%.*]]
805 // CHECK3-NEXT: i32 1, label [[OMP_SECTION_LOOP_BODY_CASE25:%.*]]
806 // CHECK3-NEXT: ]
807 // CHECK3: omp_section_loop.body.case23:
808 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM24:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1]])
809 // CHECK3-NEXT: [[TMP16:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[OMP_GLOBAL_THREAD_NUM24]], i32 3)
810 // CHECK3-NEXT: [[TMP17:%.*]] = icmp eq i32 [[TMP16]], 0
811 // CHECK3-NEXT: br i1 [[TMP17]], label [[OMP_SECTION_LOOP_BODY_CASE23_SPLIT:%.*]], label [[OMP_SECTION_LOOP_BODY_CASE23_CNCL:%.*]]
812 // CHECK3: omp_section_loop.body.case23.split:
813 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_BODY_CASE23_SECTION_AFTER:%.*]]
814 // CHECK3: omp_section_loop.body.case23.section.after:
815 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_BODY16_SECTIONS_AFTER]]
816 // CHECK3: omp_section_loop.body.case25:
817 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM27:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1]])
818 // CHECK3-NEXT: [[TMP18:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[OMP_GLOBAL_THREAD_NUM27]], i32 3)
819 // CHECK3-NEXT: [[TMP19:%.*]] = icmp eq i32 [[TMP18]], 0
820 // CHECK3-NEXT: br i1 [[TMP19]], label [[OMP_SECTION_LOOP_BODY_CASE25_SPLIT:%.*]], label [[OMP_SECTION_LOOP_BODY_CASE25_CNCL:%.*]]
821 // CHECK3: omp_section_loop.body.case25.split:
822 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_BODY_CASE25_SECTION_AFTER26:%.*]]
823 // CHECK3: omp_section_loop.body.case25.section.after26:
824 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_BODY_CASE25_SECTION_AFTER:%.*]]
825 // CHECK3: omp_section_loop.body.case25.section.after:
826 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_BODY16_SECTIONS_AFTER]]
827 // CHECK3: omp_section_loop.body16.sections.after:
828 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_INC17]]
829 // CHECK3: omp_section_loop.inc17:
830 // CHECK3-NEXT: [[OMP_SECTION_LOOP_NEXT22]] = add nuw i32 [[OMP_SECTION_LOOP_IV20]], 1
831 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_HEADER14]]
832 // CHECK3: omp_section_loop.exit18:
833 // CHECK3-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[OMP_GLOBAL_THREAD_NUM32]])
834 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM33:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1]])
835 // CHECK3-NEXT: call void @__kmpc_barrier(ptr @[[GLOB2]], i32 [[OMP_GLOBAL_THREAD_NUM33]])
836 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_AFTER19:%.*]]
837 // CHECK3: omp_section_loop.after19:
838 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_AFTER19SECTIONS_FINI:%.*]]
839 // CHECK3: omp_section_loop.after19sections.fini:
840 // CHECK3-NEXT: [[TMP20:%.*]] = load i32, ptr [[ARGC_ADDR]], align 4
841 // CHECK3-NEXT: store i32 [[TMP20]], ptr [[DOTCAPTURE_EXPR_]], align 4
842 // CHECK3-NEXT: [[TMP21:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
843 // CHECK3-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP21]], 0
844 // CHECK3-NEXT: [[DIV:%.*]] = sdiv i32 [[SUB]], 1
845 // CHECK3-NEXT: [[SUB35:%.*]] = sub nsw i32 [[DIV]], 1
846 // CHECK3-NEXT: store i32 [[SUB35]], ptr [[DOTCAPTURE_EXPR_34]], align 4
847 // CHECK3-NEXT: store i32 0, ptr [[I]], align 4
848 // CHECK3-NEXT: [[TMP22:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
849 // CHECK3-NEXT: [[CMP:%.*]] = icmp slt i32 0, [[TMP22]]
850 // CHECK3-NEXT: br i1 [[CMP]], label [[OMP_PRECOND_THEN:%.*]], label [[OMP_PRECOND_END:%.*]]
851 // CHECK3: omp.precond.then:
852 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
853 // CHECK3-NEXT: [[TMP23:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_34]], align 4
854 // CHECK3-NEXT: store i32 [[TMP23]], ptr [[DOTOMP_UB]], align 4
855 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
856 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
857 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM37:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB6:[0-9]+]])
858 // CHECK3-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB4:[0-9]+]], i32 [[OMP_GLOBAL_THREAD_NUM37]], i32 34, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_LB]], ptr [[DOTOMP_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
859 // CHECK3-NEXT: [[TMP24:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
860 // CHECK3-NEXT: [[TMP25:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_34]], align 4
861 // CHECK3-NEXT: [[CMP38:%.*]] = icmp sgt i32 [[TMP24]], [[TMP25]]
862 // CHECK3-NEXT: br i1 [[CMP38]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
863 // CHECK3: cond.true:
864 // CHECK3-NEXT: [[TMP26:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_34]], align 4
865 // CHECK3-NEXT: br label [[COND_END:%.*]]
866 // CHECK3: cond.false:
867 // CHECK3-NEXT: [[TMP27:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
868 // CHECK3-NEXT: br label [[COND_END]]
869 // CHECK3: cond.end:
870 // CHECK3-NEXT: [[COND:%.*]] = phi i32 [ [[TMP26]], [[COND_TRUE]] ], [ [[TMP27]], [[COND_FALSE]] ]
871 // CHECK3-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
872 // CHECK3-NEXT: [[TMP28:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
873 // CHECK3-NEXT: store i32 [[TMP28]], ptr [[DOTOMP_IV]], align 4
874 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
875 // CHECK3: omp.inner.for.cond:
876 // CHECK3-NEXT: [[TMP29:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
877 // CHECK3-NEXT: [[TMP30:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
878 // CHECK3-NEXT: [[CMP39:%.*]] = icmp sle i32 [[TMP29]], [[TMP30]]
879 // CHECK3-NEXT: br i1 [[CMP39]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
880 // CHECK3: omp.inner.for.body:
881 // CHECK3-NEXT: [[TMP31:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
882 // CHECK3-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP31]], 1
883 // CHECK3-NEXT: [[ADD40:%.*]] = add nsw i32 0, [[MUL]]
884 // CHECK3-NEXT: store i32 [[ADD40]], ptr [[I36]], align 4
885 // CHECK3-NEXT: [[TMP32:%.*]] = load float, ptr @flag, align 4
886 // CHECK3-NEXT: [[TOBOOL41:%.*]] = fcmp une float [[TMP32]], 0.000000e+00
887 // CHECK3-NEXT: br i1 [[TOBOOL41]], label [[OMP_IF_THEN:%.*]], label [[OMP_IF_ELSE:%.*]]
888 // CHECK3: omp_if.then:
889 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM42:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB8:[0-9]+]])
890 // CHECK3-NEXT: [[TMP33:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[OMP_GLOBAL_THREAD_NUM42]], i32 2)
891 // CHECK3-NEXT: [[TMP34:%.*]] = icmp ne i32 [[TMP33]], 0
892 // CHECK3-NEXT: br i1 [[TMP34]], label [[DOTCANCEL_EXIT:%.*]], label [[DOTCANCEL_CONTINUE:%.*]]
893 // CHECK3: .cancel.exit:
894 // CHECK3-NEXT: br label [[CANCEL_EXIT:%.*]]
895 // CHECK3: omp_section_loop.body.case.cncl:
896 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_EXIT]]
897 // CHECK3: omp_section_loop.body.case23.cncl:
898 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_EXIT18]]
899 // CHECK3: omp_section_loop.body.case25.cncl:
900 // CHECK3-NEXT: br label [[OMP_SECTION_LOOP_EXIT18]]
901 // CHECK3: .cancel.continue:
902 // CHECK3-NEXT: br label [[OMP_IF_END:%.*]]
903 // CHECK3: omp_if.else:
904 // CHECK3-NEXT: br label [[OMP_IF_END]]
905 // CHECK3: omp_if.end:
906 // CHECK3-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
907 // CHECK3: omp.body.continue:
908 // CHECK3-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
909 // CHECK3: omp.inner.for.inc:
910 // CHECK3-NEXT: [[TMP35:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
911 // CHECK3-NEXT: [[ADD43:%.*]] = add nsw i32 [[TMP35]], 1
912 // CHECK3-NEXT: store i32 [[ADD43]], ptr [[DOTOMP_IV]], align 4
913 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND]]
914 // CHECK3: omp.inner.for.end:
915 // CHECK3-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
916 // CHECK3: omp.loop.exit:
917 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM45:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB10:[0-9]+]])
918 // CHECK3-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB4]], i32 [[OMP_GLOBAL_THREAD_NUM45]])
919 // CHECK3-NEXT: br label [[OMP_PRECOND_END]]
920 // CHECK3: cancel.exit:
921 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM44:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB10]])
922 // CHECK3-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB4]], i32 [[OMP_GLOBAL_THREAD_NUM44]])
923 // CHECK3-NEXT: br label [[CANCEL_CONT:%.*]]
924 // CHECK3: omp.precond.end:
925 // CHECK3-NEXT: br label [[CANCEL_CONT]]
926 // CHECK3: cancel.cont:
927 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM46:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1]])
928 // CHECK3-NEXT: call void @__kmpc_barrier(ptr @[[GLOB2]], i32 [[OMP_GLOBAL_THREAD_NUM46]])
929 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM47:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB14:[0-9]+]])
930 // CHECK3-NEXT: [[TMP36:%.*]] = call ptr @__kmpc_omp_task_alloc(ptr @[[GLOB1]], i32 [[OMP_GLOBAL_THREAD_NUM47]], i32 1, i64 40, i64 1, ptr @.omp_task_entry.)
931 // CHECK3-NEXT: [[TMP37:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_T_WITH_PRIVATES:%.*]], ptr [[TMP36]], i32 0, i32 0
932 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM48:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB14]])
933 // CHECK3-NEXT: [[TMP38:%.*]] = call i32 @__kmpc_omp_task(ptr @[[GLOB1]], i32 [[OMP_GLOBAL_THREAD_NUM48]], ptr [[TMP36]])
934 // CHECK3-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB1]], i32 0, ptr @main.omp_outlined)
935 // CHECK3-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB1]], i32 0, ptr @main.omp_outlined.1)
936 // CHECK3-NEXT: store i32 0, ptr [[R]], align 4
937 // CHECK3-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB1]], i32 2, ptr @main.omp_outlined.2, ptr [[ARGC_ADDR]], ptr [[R]])
938 // CHECK3-NEXT: [[TMP39:%.*]] = load i32, ptr [[ARGC_ADDR]], align 4
939 // CHECK3-NEXT: ret i32 [[TMP39]]
942 // CHECK3-LABEL: define {{[^@]+}}@main..omp_par
943 // CHECK3-SAME: (ptr noalias [[TID_ADDR:%.*]], ptr noalias [[ZERO_ADDR:%.*]], ptr [[TMP0:%.*]]) #[[ATTR1:[0-9]+]] {
944 // CHECK3-NEXT: omp.par.entry:
945 // CHECK3-NEXT: [[GEP_ARGC_ADDR:%.*]] = getelementptr { ptr, ptr }, ptr [[TMP0]], i32 0, i32 0
946 // CHECK3-NEXT: [[LOADGEP_ARGC_ADDR:%.*]] = load ptr, ptr [[GEP_ARGC_ADDR]], align 8
947 // CHECK3-NEXT: [[GEP_ARGV_ADDR:%.*]] = getelementptr { ptr, ptr }, ptr [[TMP0]], i32 0, i32 1
948 // CHECK3-NEXT: [[LOADGEP_ARGV_ADDR:%.*]] = load ptr, ptr [[GEP_ARGV_ADDR]], align 8
949 // CHECK3-NEXT: [[TID_ADDR_LOCAL:%.*]] = alloca i32, align 4
950 // CHECK3-NEXT: [[TMP1:%.*]] = load i32, ptr [[TID_ADDR]], align 4
951 // CHECK3-NEXT: store i32 [[TMP1]], ptr [[TID_ADDR_LOCAL]], align 4
952 // CHECK3-NEXT: [[TID:%.*]] = load i32, ptr [[TID_ADDR_LOCAL]], align 4
953 // CHECK3-NEXT: br label [[OMP_PAR_REGION:%.*]]
954 // CHECK3: omp.par.region:
955 // CHECK3-NEXT: [[TMP2:%.*]] = load float, ptr @flag, align 4
956 // CHECK3-NEXT: [[TOBOOL:%.*]] = fcmp une float [[TMP2]], 0.000000e+00
957 // CHECK3-NEXT: br i1 [[TOBOOL]], label [[TMP14:%.*]], label [[TMP3:%.*]]
958 // CHECK3: 3:
959 // CHECK3-NEXT: br label [[TMP4:%.*]]
960 // CHECK3: 4:
961 // CHECK3-NEXT: [[TMP5:%.*]] = load i32, ptr [[LOADGEP_ARGC_ADDR]], align 4
962 // CHECK3-NEXT: [[CONV:%.*]] = trunc i32 [[TMP5]] to i8
963 // CHECK3-NEXT: [[TMP6:%.*]] = load ptr, ptr [[LOADGEP_ARGV_ADDR]], align 8
964 // CHECK3-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds ptr, ptr [[TMP6]], i64 0
965 // CHECK3-NEXT: [[TMP7:%.*]] = load ptr, ptr [[ARRAYIDX]], align 8
966 // CHECK3-NEXT: [[ARRAYIDX3:%.*]] = getelementptr inbounds i8, ptr [[TMP7]], i64 0
967 // CHECK3-NEXT: store i8 [[CONV]], ptr [[ARRAYIDX3]], align 1
968 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM4:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1]])
969 // CHECK3-NEXT: [[TMP8:%.*]] = call i32 @__kmpc_cancel_barrier(ptr @[[GLOB3:[0-9]+]], i32 [[OMP_GLOBAL_THREAD_NUM4]])
970 // CHECK3-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP8]], 0
971 // CHECK3-NEXT: br i1 [[TMP9]], label [[DOTCONT:%.*]], label [[DOTCNCL5:%.*]]
972 // CHECK3: .cncl5:
973 // CHECK3-NEXT: br label [[OMP_PAR_OUTLINED_EXIT_EXITSTUB:%.*]]
974 // CHECK3: .cont:
975 // CHECK3-NEXT: [[TMP10:%.*]] = load i32, ptr [[LOADGEP_ARGC_ADDR]], align 4
976 // CHECK3-NEXT: [[TMP11:%.*]] = load ptr, ptr [[LOADGEP_ARGV_ADDR]], align 8
977 // CHECK3-NEXT: [[ARRAYIDX6:%.*]] = getelementptr inbounds ptr, ptr [[TMP11]], i64 0
978 // CHECK3-NEXT: [[TMP12:%.*]] = load ptr, ptr [[ARRAYIDX6]], align 8
979 // CHECK3-NEXT: [[ARRAYIDX7:%.*]] = getelementptr inbounds i8, ptr [[TMP12]], i64 0
980 // CHECK3-NEXT: [[TMP13:%.*]] = load i8, ptr [[ARRAYIDX7]], align 1
981 // CHECK3-NEXT: [[CONV8:%.*]] = sext i8 [[TMP13]] to i32
982 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 [[CONV8]], [[TMP10]]
983 // CHECK3-NEXT: [[CONV9:%.*]] = trunc i32 [[ADD]] to i8
984 // CHECK3-NEXT: store i8 [[CONV9]], ptr [[ARRAYIDX7]], align 1
985 // CHECK3-NEXT: br label [[OMP_PAR_REGION_PARALLEL_AFTER:%.*]]
986 // CHECK3: omp.par.region.parallel.after:
987 // CHECK3-NEXT: br label [[OMP_PAR_PRE_FINALIZE:%.*]]
988 // CHECK3: omp.par.pre_finalize:
989 // CHECK3-NEXT: br label [[OMP_PAR_OUTLINED_EXIT_EXITSTUB]]
990 // CHECK3: 14:
991 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM1:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1]])
992 // CHECK3-NEXT: [[TMP15:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[OMP_GLOBAL_THREAD_NUM1]], i32 1)
993 // CHECK3-NEXT: [[TMP16:%.*]] = icmp eq i32 [[TMP15]], 0
994 // CHECK3-NEXT: br i1 [[TMP16]], label [[DOTSPLIT:%.*]], label [[DOTCNCL:%.*]]
995 // CHECK3: .cncl:
996 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM2:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1]])
997 // CHECK3-NEXT: [[TMP17:%.*]] = call i32 @__kmpc_cancel_barrier(ptr @[[GLOB2]], i32 [[OMP_GLOBAL_THREAD_NUM2]])
998 // CHECK3-NEXT: br label [[OMP_PAR_OUTLINED_EXIT_EXITSTUB]]
999 // CHECK3: .split:
1000 // CHECK3-NEXT: br label [[TMP4]]
1001 // CHECK3: omp.par.outlined.exit.exitStub:
1002 // CHECK3-NEXT: ret void
1005 // CHECK3-LABEL: define {{[^@]+}}@.omp_task_entry.
1006 // CHECK3-SAME: (i32 noundef [[TMP0:%.*]], ptr noalias noundef [[TMP1:%.*]]) #[[ATTR4:[0-9]+]] {
1007 // CHECK3-NEXT: entry:
1008 // CHECK3-NEXT: [[DOTGLOBAL_TID__ADDR_I:%.*]] = alloca i32, align 4
1009 // CHECK3-NEXT: [[DOTPART_ID__ADDR_I:%.*]] = alloca ptr, align 8
1010 // CHECK3-NEXT: [[DOTPRIVATES__ADDR_I:%.*]] = alloca ptr, align 8
1011 // CHECK3-NEXT: [[DOTCOPY_FN__ADDR_I:%.*]] = alloca ptr, align 8
1012 // CHECK3-NEXT: [[DOTTASK_T__ADDR_I:%.*]] = alloca ptr, align 8
1013 // CHECK3-NEXT: [[__CONTEXT_ADDR_I:%.*]] = alloca ptr, align 8
1014 // CHECK3-NEXT: [[CLEANUP_DEST_SLOT_I:%.*]] = alloca i32, align 4
1015 // CHECK3-NEXT: [[DOTADDR:%.*]] = alloca i32, align 4
1016 // CHECK3-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 8
1017 // CHECK3-NEXT: store i32 [[TMP0]], ptr [[DOTADDR]], align 4
1018 // CHECK3-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 8
1019 // CHECK3-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTADDR]], align 4
1020 // CHECK3-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 8
1021 // CHECK3-NEXT: [[TMP4:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_T_WITH_PRIVATES:%.*]], ptr [[TMP3]], i32 0, i32 0
1022 // CHECK3-NEXT: [[TMP5:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_T:%.*]], ptr [[TMP4]], i32 0, i32 2
1023 // CHECK3-NEXT: [[TMP6:%.*]] = getelementptr inbounds [[STRUCT_KMP_TASK_T]], ptr [[TMP4]], i32 0, i32 0
1024 // CHECK3-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 8
1025 // CHECK3-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META5:![0-9]+]])
1026 // CHECK3-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META8:![0-9]+]])
1027 // CHECK3-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META10:![0-9]+]])
1028 // CHECK3-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META12:![0-9]+]])
1029 // CHECK3-NEXT: store i32 [[TMP2]], ptr [[DOTGLOBAL_TID__ADDR_I]], align 4, !noalias !14
1030 // CHECK3-NEXT: store ptr [[TMP5]], ptr [[DOTPART_ID__ADDR_I]], align 8, !noalias !14
1031 // CHECK3-NEXT: store ptr null, ptr [[DOTPRIVATES__ADDR_I]], align 8, !noalias !14
1032 // CHECK3-NEXT: store ptr null, ptr [[DOTCOPY_FN__ADDR_I]], align 8, !noalias !14
1033 // CHECK3-NEXT: store ptr [[TMP3]], ptr [[DOTTASK_T__ADDR_I]], align 8, !noalias !14
1034 // CHECK3-NEXT: store ptr [[TMP7]], ptr [[__CONTEXT_ADDR_I]], align 8, !noalias !14
1035 // CHECK3-NEXT: [[TMP8:%.*]] = load ptr, ptr [[__CONTEXT_ADDR_I]], align 8, !noalias !14
1036 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM_I:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB12:[0-9]+]])
1037 // CHECK3-NEXT: [[TMP9:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[OMP_GLOBAL_THREAD_NUM_I]], i32 4)
1038 // CHECK3-NEXT: [[TMP10:%.*]] = icmp ne i32 [[TMP9]], 0
1039 // CHECK3-NEXT: br i1 [[TMP10]], label [[DOTCANCEL_EXIT_I:%.*]], label [[DOTCANCEL_CONTINUE_I:%.*]]
1040 // CHECK3: .cancel.exit.i:
1041 // CHECK3-NEXT: store i32 1, ptr [[CLEANUP_DEST_SLOT_I]], align 4, !noalias !14
1042 // CHECK3-NEXT: br label [[DOTOMP_OUTLINED__EXIT:%.*]]
1043 // CHECK3: .cancel.continue.i:
1044 // CHECK3-NEXT: store i32 0, ptr [[CLEANUP_DEST_SLOT_I]], align 4, !noalias !14
1045 // CHECK3-NEXT: br label [[DOTOMP_OUTLINED__EXIT]]
1046 // CHECK3: .omp_outlined..exit:
1047 // CHECK3-NEXT: [[CLEANUP_DEST_I:%.*]] = load i32, ptr [[CLEANUP_DEST_SLOT_I]], align 4, !noalias !14
1048 // CHECK3-NEXT: ret i32 0
1051 // CHECK3-LABEL: define {{[^@]+}}@main.omp_outlined
1052 // CHECK3-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]]) #[[ATTR5:[0-9]+]] {
1053 // CHECK3-NEXT: entry:
1054 // CHECK3-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
1055 // CHECK3-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
1056 // CHECK3-NEXT: [[DOTOMP_SECTIONS_LB_:%.*]] = alloca i32, align 4
1057 // CHECK3-NEXT: [[DOTOMP_SECTIONS_UB_:%.*]] = alloca i32, align 4
1058 // CHECK3-NEXT: [[DOTOMP_SECTIONS_ST_:%.*]] = alloca i32, align 4
1059 // CHECK3-NEXT: [[DOTOMP_SECTIONS_IL_:%.*]] = alloca i32, align 4
1060 // CHECK3-NEXT: [[DOTOMP_SECTIONS_IV_:%.*]] = alloca i32, align 4
1061 // CHECK3-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
1062 // CHECK3-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
1063 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_LB_]], align 4
1064 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_UB_]], align 4
1065 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_SECTIONS_ST_]], align 4
1066 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_IL_]], align 4
1067 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB17:[0-9]+]])
1068 // CHECK3-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB15:[0-9]+]], i32 [[OMP_GLOBAL_THREAD_NUM]], i32 34, ptr [[DOTOMP_SECTIONS_IL_]], ptr [[DOTOMP_SECTIONS_LB_]], ptr [[DOTOMP_SECTIONS_UB_]], ptr [[DOTOMP_SECTIONS_ST_]], i32 1, i32 1)
1069 // CHECK3-NEXT: [[TMP0:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_]], align 4
1070 // CHECK3-NEXT: [[TMP1:%.*]] = icmp slt i32 [[TMP0]], 0
1071 // CHECK3-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 [[TMP0]], i32 0
1072 // CHECK3-NEXT: store i32 [[TMP2]], ptr [[DOTOMP_SECTIONS_UB_]], align 4
1073 // CHECK3-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_LB_]], align 4
1074 // CHECK3-NEXT: store i32 [[TMP3]], ptr [[DOTOMP_SECTIONS_IV_]], align 4
1075 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
1076 // CHECK3: omp.inner.for.cond:
1077 // CHECK3-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
1078 // CHECK3-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_]], align 4
1079 // CHECK3-NEXT: [[CMP:%.*]] = icmp sle i32 [[TMP4]], [[TMP5]]
1080 // CHECK3-NEXT: br i1 [[CMP]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
1081 // CHECK3: omp.inner.for.body:
1082 // CHECK3-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
1083 // CHECK3-NEXT: switch i32 [[TMP6]], label [[DOTOMP_SECTIONS_EXIT:%.*]] [
1084 // CHECK3-NEXT: i32 0, label [[DOTOMP_SECTIONS_CASE:%.*]]
1085 // CHECK3-NEXT: ]
1086 // CHECK3: .omp.sections.case:
1087 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM1:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1]])
1088 // CHECK3-NEXT: [[TMP7:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[OMP_GLOBAL_THREAD_NUM1]], i32 3)
1089 // CHECK3-NEXT: [[TMP8:%.*]] = icmp eq i32 [[TMP7]], 0
1090 // CHECK3-NEXT: br i1 [[TMP8]], label [[DOTOMP_SECTIONS_CASE_SPLIT:%.*]], label [[DOTOMP_SECTIONS_CASE_CNCL:%.*]]
1091 // CHECK3: .omp.sections.case.split:
1092 // CHECK3-NEXT: br label [[DOTOMP_SECTIONS_EXIT]]
1093 // CHECK3: .omp.sections.case.cncl:
1094 // CHECK3-NEXT: br label [[CANCEL_CONT:%.*]]
1095 // CHECK3: .omp.sections.exit:
1096 // CHECK3-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
1097 // CHECK3: omp.inner.for.inc:
1098 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
1099 // CHECK3-NEXT: [[INC:%.*]] = add nsw i32 [[TMP9]], 1
1100 // CHECK3-NEXT: store i32 [[INC]], ptr [[DOTOMP_SECTIONS_IV_]], align 4
1101 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND]]
1102 // CHECK3: omp.inner.for.end:
1103 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM3:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB19:[0-9]+]])
1104 // CHECK3-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB15]], i32 [[OMP_GLOBAL_THREAD_NUM3]])
1105 // CHECK3-NEXT: br label [[CANCEL_CONT]]
1106 // CHECK3: cancel.cont:
1107 // CHECK3-NEXT: ret void
1108 // CHECK3: cancel.exit:
1109 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM2:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB19]])
1110 // CHECK3-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB15]], i32 [[OMP_GLOBAL_THREAD_NUM2]])
1111 // CHECK3-NEXT: br label [[CANCEL_CONT]]
1114 // CHECK3-LABEL: define {{[^@]+}}@main.omp_outlined.1
1115 // CHECK3-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]]) #[[ATTR5]] {
1116 // CHECK3-NEXT: entry:
1117 // CHECK3-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
1118 // CHECK3-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
1119 // CHECK3-NEXT: [[DOTOMP_SECTIONS_LB_:%.*]] = alloca i32, align 4
1120 // CHECK3-NEXT: [[DOTOMP_SECTIONS_UB_:%.*]] = alloca i32, align 4
1121 // CHECK3-NEXT: [[DOTOMP_SECTIONS_ST_:%.*]] = alloca i32, align 4
1122 // CHECK3-NEXT: [[DOTOMP_SECTIONS_IL_:%.*]] = alloca i32, align 4
1123 // CHECK3-NEXT: [[DOTOMP_SECTIONS_IV_:%.*]] = alloca i32, align 4
1124 // CHECK3-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
1125 // CHECK3-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
1126 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_LB_]], align 4
1127 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_SECTIONS_UB_]], align 4
1128 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_SECTIONS_ST_]], align 4
1129 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_SECTIONS_IL_]], align 4
1130 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB21:[0-9]+]])
1131 // CHECK3-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB15]], i32 [[OMP_GLOBAL_THREAD_NUM]], i32 34, ptr [[DOTOMP_SECTIONS_IL_]], ptr [[DOTOMP_SECTIONS_LB_]], ptr [[DOTOMP_SECTIONS_UB_]], ptr [[DOTOMP_SECTIONS_ST_]], i32 1, i32 1)
1132 // CHECK3-NEXT: [[TMP0:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_]], align 4
1133 // CHECK3-NEXT: [[TMP1:%.*]] = icmp slt i32 [[TMP0]], 1
1134 // CHECK3-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i32 [[TMP0]], i32 1
1135 // CHECK3-NEXT: store i32 [[TMP2]], ptr [[DOTOMP_SECTIONS_UB_]], align 4
1136 // CHECK3-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_LB_]], align 4
1137 // CHECK3-NEXT: store i32 [[TMP3]], ptr [[DOTOMP_SECTIONS_IV_]], align 4
1138 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
1139 // CHECK3: omp.inner.for.cond:
1140 // CHECK3-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
1141 // CHECK3-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_UB_]], align 4
1142 // CHECK3-NEXT: [[CMP:%.*]] = icmp sle i32 [[TMP4]], [[TMP5]]
1143 // CHECK3-NEXT: br i1 [[CMP]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
1144 // CHECK3: omp.inner.for.body:
1145 // CHECK3-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
1146 // CHECK3-NEXT: switch i32 [[TMP6]], label [[DOTOMP_SECTIONS_EXIT:%.*]] [
1147 // CHECK3-NEXT: i32 0, label [[DOTOMP_SECTIONS_CASE:%.*]]
1148 // CHECK3-NEXT: i32 1, label [[DOTOMP_SECTIONS_CASE2:%.*]]
1149 // CHECK3-NEXT: ]
1150 // CHECK3: .omp.sections.case:
1151 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM1:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1]])
1152 // CHECK3-NEXT: [[TMP7:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[OMP_GLOBAL_THREAD_NUM1]], i32 3)
1153 // CHECK3-NEXT: [[TMP8:%.*]] = icmp eq i32 [[TMP7]], 0
1154 // CHECK3-NEXT: br i1 [[TMP8]], label [[DOTOMP_SECTIONS_CASE_SPLIT:%.*]], label [[DOTOMP_SECTIONS_CASE_CNCL:%.*]]
1155 // CHECK3: .omp.sections.case.split:
1156 // CHECK3-NEXT: br label [[DOTOMP_SECTIONS_EXIT]]
1157 // CHECK3: .omp.sections.case.cncl:
1158 // CHECK3-NEXT: br label [[CANCEL_CONT:%.*]]
1159 // CHECK3: .omp.sections.case2:
1160 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM3:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1]])
1161 // CHECK3-NEXT: [[TMP9:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[OMP_GLOBAL_THREAD_NUM3]], i32 3)
1162 // CHECK3-NEXT: [[TMP10:%.*]] = icmp eq i32 [[TMP9]], 0
1163 // CHECK3-NEXT: br i1 [[TMP10]], label [[DOTOMP_SECTIONS_CASE2_SPLIT:%.*]], label [[DOTOMP_SECTIONS_CASE2_CNCL:%.*]]
1164 // CHECK3: .omp.sections.case2.split:
1165 // CHECK3-NEXT: br label [[DOTOMP_SECTIONS_CASE2_SECTION_AFTER:%.*]]
1166 // CHECK3: .omp.sections.case2.section.after:
1167 // CHECK3-NEXT: br label [[DOTOMP_SECTIONS_EXIT]]
1168 // CHECK3: .omp.sections.case2.cncl:
1169 // CHECK3-NEXT: br label [[OMP_INNER_FOR_END]]
1170 // CHECK3: .omp.sections.exit:
1171 // CHECK3-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
1172 // CHECK3: omp.inner.for.inc:
1173 // CHECK3-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_SECTIONS_IV_]], align 4
1174 // CHECK3-NEXT: [[INC:%.*]] = add nsw i32 [[TMP11]], 1
1175 // CHECK3-NEXT: store i32 [[INC]], ptr [[DOTOMP_SECTIONS_IV_]], align 4
1176 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND]]
1177 // CHECK3: omp.inner.for.end:
1178 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM5:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB23:[0-9]+]])
1179 // CHECK3-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB15]], i32 [[OMP_GLOBAL_THREAD_NUM5]])
1180 // CHECK3-NEXT: br label [[CANCEL_CONT]]
1181 // CHECK3: cancel.cont:
1182 // CHECK3-NEXT: ret void
1183 // CHECK3: cancel.exit:
1184 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM4:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB23]])
1185 // CHECK3-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB15]], i32 [[OMP_GLOBAL_THREAD_NUM4]])
1186 // CHECK3-NEXT: br label [[CANCEL_CONT]]
1189 // CHECK3-LABEL: define {{[^@]+}}@main.omp_outlined.2
1190 // CHECK3-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[ARGC:%.*]], ptr noundef nonnull align 4 dereferenceable(4) [[R:%.*]]) #[[ATTR5]] {
1191 // CHECK3-NEXT: entry:
1192 // CHECK3-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
1193 // CHECK3-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
1194 // CHECK3-NEXT: [[ARGC_ADDR:%.*]] = alloca ptr, align 8
1195 // CHECK3-NEXT: [[R_ADDR:%.*]] = alloca ptr, align 8
1196 // CHECK3-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
1197 // CHECK3-NEXT: [[TMP:%.*]] = alloca i32, align 4
1198 // CHECK3-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
1199 // CHECK3-NEXT: [[DOTCAPTURE_EXPR_1:%.*]] = alloca i32, align 4
1200 // CHECK3-NEXT: [[I:%.*]] = alloca i32, align 4
1201 // CHECK3-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
1202 // CHECK3-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
1203 // CHECK3-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
1204 // CHECK3-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
1205 // CHECK3-NEXT: [[R3:%.*]] = alloca i32, align 4
1206 // CHECK3-NEXT: [[I4:%.*]] = alloca i32, align 4
1207 // CHECK3-NEXT: [[DOTOMP_REDUCTION_RED_LIST:%.*]] = alloca [1 x ptr], align 8
1208 // CHECK3-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
1209 // CHECK3-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
1210 // CHECK3-NEXT: store ptr [[ARGC]], ptr [[ARGC_ADDR]], align 8
1211 // CHECK3-NEXT: store ptr [[R]], ptr [[R_ADDR]], align 8
1212 // CHECK3-NEXT: [[TMP0:%.*]] = load ptr, ptr [[ARGC_ADDR]], align 8
1213 // CHECK3-NEXT: [[TMP1:%.*]] = load ptr, ptr [[R_ADDR]], align 8
1214 // CHECK3-NEXT: [[TMP2:%.*]] = load i32, ptr [[TMP0]], align 4
1215 // CHECK3-NEXT: store i32 [[TMP2]], ptr [[DOTCAPTURE_EXPR_]], align 4
1216 // CHECK3-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
1217 // CHECK3-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP3]], 0
1218 // CHECK3-NEXT: [[DIV:%.*]] = sdiv i32 [[SUB]], 1
1219 // CHECK3-NEXT: [[SUB2:%.*]] = sub nsw i32 [[DIV]], 1
1220 // CHECK3-NEXT: store i32 [[SUB2]], ptr [[DOTCAPTURE_EXPR_1]], align 4
1221 // CHECK3-NEXT: store i32 0, ptr [[I]], align 4
1222 // CHECK3-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
1223 // CHECK3-NEXT: [[CMP:%.*]] = icmp slt i32 0, [[TMP4]]
1224 // CHECK3-NEXT: br i1 [[CMP]], label [[OMP_PRECOND_THEN:%.*]], label [[OMP_PRECOND_END:%.*]]
1225 // CHECK3: omp.precond.then:
1226 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
1227 // CHECK3-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
1228 // CHECK3-NEXT: store i32 [[TMP5]], ptr [[DOTOMP_UB]], align 4
1229 // CHECK3-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
1230 // CHECK3-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
1231 // CHECK3-NEXT: store i32 0, ptr [[R3]], align 4
1232 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB25:[0-9]+]])
1233 // CHECK3-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB4]], i32 [[OMP_GLOBAL_THREAD_NUM]], i32 34, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_LB]], ptr [[DOTOMP_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
1234 // CHECK3-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
1235 // CHECK3-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
1236 // CHECK3-NEXT: [[CMP5:%.*]] = icmp sgt i32 [[TMP6]], [[TMP7]]
1237 // CHECK3-NEXT: br i1 [[CMP5]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
1238 // CHECK3: cond.true:
1239 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
1240 // CHECK3-NEXT: br label [[COND_END:%.*]]
1241 // CHECK3: cond.false:
1242 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
1243 // CHECK3-NEXT: br label [[COND_END]]
1244 // CHECK3: cond.end:
1245 // CHECK3-NEXT: [[COND:%.*]] = phi i32 [ [[TMP8]], [[COND_TRUE]] ], [ [[TMP9]], [[COND_FALSE]] ]
1246 // CHECK3-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
1247 // CHECK3-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
1248 // CHECK3-NEXT: store i32 [[TMP10]], ptr [[DOTOMP_IV]], align 4
1249 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
1250 // CHECK3: omp.inner.for.cond:
1251 // CHECK3-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1252 // CHECK3-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
1253 // CHECK3-NEXT: [[CMP6:%.*]] = icmp sle i32 [[TMP11]], [[TMP12]]
1254 // CHECK3-NEXT: br i1 [[CMP6]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
1255 // CHECK3: omp.inner.for.body:
1256 // CHECK3-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1257 // CHECK3-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP13]], 1
1258 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
1259 // CHECK3-NEXT: store i32 [[ADD]], ptr [[I4]], align 4
1260 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM7:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB27:[0-9]+]])
1261 // CHECK3-NEXT: [[TMP14:%.*]] = call i32 @__kmpc_cancel(ptr @[[GLOB1]], i32 [[OMP_GLOBAL_THREAD_NUM7]], i32 2)
1262 // CHECK3-NEXT: [[TMP15:%.*]] = icmp ne i32 [[TMP14]], 0
1263 // CHECK3-NEXT: br i1 [[TMP15]], label [[DOTCANCEL_EXIT:%.*]], label [[DOTCANCEL_CONTINUE:%.*]]
1264 // CHECK3: .cancel.exit:
1265 // CHECK3-NEXT: br label [[CANCEL_EXIT:%.*]]
1266 // CHECK3: .cancel.continue:
1267 // CHECK3-NEXT: [[TMP16:%.*]] = load i32, ptr [[I4]], align 4
1268 // CHECK3-NEXT: [[TMP17:%.*]] = load i32, ptr [[R3]], align 4
1269 // CHECK3-NEXT: [[ADD8:%.*]] = add nsw i32 [[TMP17]], [[TMP16]]
1270 // CHECK3-NEXT: store i32 [[ADD8]], ptr [[R3]], align 4
1271 // CHECK3-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
1272 // CHECK3: omp.body.continue:
1273 // CHECK3-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
1274 // CHECK3: omp.inner.for.inc:
1275 // CHECK3-NEXT: [[TMP18:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
1276 // CHECK3-NEXT: [[ADD9:%.*]] = add nsw i32 [[TMP18]], 1
1277 // CHECK3-NEXT: store i32 [[ADD9]], ptr [[DOTOMP_IV]], align 4
1278 // CHECK3-NEXT: br label [[OMP_INNER_FOR_COND]]
1279 // CHECK3: omp.inner.for.end:
1280 // CHECK3-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
1281 // CHECK3: omp.loop.exit:
1282 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM11:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB29:[0-9]+]])
1283 // CHECK3-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB4]], i32 [[OMP_GLOBAL_THREAD_NUM11]])
1284 // CHECK3-NEXT: [[TMP19:%.*]] = getelementptr inbounds [1 x ptr], ptr [[DOTOMP_REDUCTION_RED_LIST]], i64 0, i64 0
1285 // CHECK3-NEXT: store ptr [[R3]], ptr [[TMP19]], align 8
1286 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM12:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB29]])
1287 // CHECK3-NEXT: [[TMP20:%.*]] = call i32 @__kmpc_reduce_nowait(ptr @[[GLOB30:[0-9]+]], i32 [[OMP_GLOBAL_THREAD_NUM12]], i32 1, i64 8, ptr [[DOTOMP_REDUCTION_RED_LIST]], ptr @main.omp_outlined.2.omp.reduction.reduction_func, ptr @.gomp_critical_user_.reduction.var)
1288 // CHECK3-NEXT: switch i32 [[TMP20]], label [[DOTOMP_REDUCTION_DEFAULT:%.*]] [
1289 // CHECK3-NEXT: i32 1, label [[DOTOMP_REDUCTION_CASE1:%.*]]
1290 // CHECK3-NEXT: i32 2, label [[DOTOMP_REDUCTION_CASE2:%.*]]
1291 // CHECK3-NEXT: ]
1292 // CHECK3: .omp.reduction.case1:
1293 // CHECK3-NEXT: [[TMP21:%.*]] = load i32, ptr [[TMP1]], align 4
1294 // CHECK3-NEXT: [[TMP22:%.*]] = load i32, ptr [[R3]], align 4
1295 // CHECK3-NEXT: [[ADD13:%.*]] = add nsw i32 [[TMP21]], [[TMP22]]
1296 // CHECK3-NEXT: store i32 [[ADD13]], ptr [[TMP1]], align 4
1297 // CHECK3-NEXT: call void @__kmpc_end_reduce_nowait(ptr @[[GLOB30]], i32 [[OMP_GLOBAL_THREAD_NUM12]], ptr @.gomp_critical_user_.reduction.var)
1298 // CHECK3-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
1299 // CHECK3: cancel.exit:
1300 // CHECK3-NEXT: [[OMP_GLOBAL_THREAD_NUM10:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB29]])
1301 // CHECK3-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB4]], i32 [[OMP_GLOBAL_THREAD_NUM10]])
1302 // CHECK3-NEXT: br label [[CANCEL_CONT:%.*]]
1303 // CHECK3: .omp.reduction.case2:
1304 // CHECK3-NEXT: [[TMP23:%.*]] = load i32, ptr [[R3]], align 4
1305 // CHECK3-NEXT: [[TMP24:%.*]] = atomicrmw add ptr [[TMP1]], i32 [[TMP23]] monotonic, align 4
1306 // CHECK3-NEXT: br label [[DOTOMP_REDUCTION_DEFAULT]]
1307 // CHECK3: .omp.reduction.default:
1308 // CHECK3-NEXT: br label [[OMP_PRECOND_END]]
1309 // CHECK3: omp.precond.end:
1310 // CHECK3-NEXT: br label [[CANCEL_CONT]]
1311 // CHECK3: cancel.cont:
1312 // CHECK3-NEXT: ret void
1315 // CHECK3-LABEL: define {{[^@]+}}@main.omp_outlined.2.omp.reduction.reduction_func
1316 // CHECK3-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR4]] {
1317 // CHECK3-NEXT: entry:
1318 // CHECK3-NEXT: [[DOTADDR:%.*]] = alloca ptr, align 8
1319 // CHECK3-NEXT: [[DOTADDR1:%.*]] = alloca ptr, align 8
1320 // CHECK3-NEXT: store ptr [[TMP0]], ptr [[DOTADDR]], align 8
1321 // CHECK3-NEXT: store ptr [[TMP1]], ptr [[DOTADDR1]], align 8
1322 // CHECK3-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTADDR]], align 8
1323 // CHECK3-NEXT: [[TMP3:%.*]] = load ptr, ptr [[DOTADDR1]], align 8
1324 // CHECK3-NEXT: [[TMP4:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP3]], i64 0, i64 0
1325 // CHECK3-NEXT: [[TMP5:%.*]] = load ptr, ptr [[TMP4]], align 8
1326 // CHECK3-NEXT: [[TMP6:%.*]] = getelementptr inbounds [1 x ptr], ptr [[TMP2]], i64 0, i64 0
1327 // CHECK3-NEXT: [[TMP7:%.*]] = load ptr, ptr [[TMP6]], align 8
1328 // CHECK3-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP7]], align 4
1329 // CHECK3-NEXT: [[TMP9:%.*]] = load i32, ptr [[TMP5]], align 4
1330 // CHECK3-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP8]], [[TMP9]]
1331 // CHECK3-NEXT: store i32 [[ADD]], ptr [[TMP7]], align 4
1332 // CHECK3-NEXT: ret void