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 // add -fopenmp-targets
4 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK1
5 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
6 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix=CHECK1
8 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
9 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
10 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --implicit-check-not="{{__kmpc|__tgt}}"
11 // expected-no-diagnostics
15 typedef __INTPTR_TYPE__
intptr_t;
22 S(intptr_t a
) : a(a
) {}
23 operator char() { return a
; }
30 #pragma omp teams distribute parallel for proc_bind(master)
31 for(int i
= 0; i
< 1000; i
++) {}
37 #pragma omp teams distribute parallel for proc_bind(spread)
38 for(int i
= 0; i
< 1000; i
++) {}
40 #pragma omp teams distribute parallel for proc_bind(close)
41 for(int i
= 0; i
< 1000; i
++) {}
53 // CHECK1-LABEL: define {{[^@]+}}@main
54 // CHECK1-SAME: () #[[ATTR0:[0-9]+]] {
55 // CHECK1-NEXT: entry:
56 // CHECK1-NEXT: [[RETVAL:%.*]] = alloca i32, align 4
57 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
58 // CHECK1-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
59 // CHECK1-NEXT: [[_TMP1:%.*]] = alloca i32, align 4
60 // CHECK1-NEXT: [[KERNEL_ARGS2:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS]], align 8
61 // CHECK1-NEXT: store i32 0, ptr [[RETVAL]], align 4
62 // CHECK1-NEXT: [[TMP0:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
63 // CHECK1-NEXT: store i32 3, ptr [[TMP0]], align 4
64 // CHECK1-NEXT: [[TMP1:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
65 // CHECK1-NEXT: store i32 0, ptr [[TMP1]], align 4
66 // CHECK1-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
67 // CHECK1-NEXT: store ptr null, ptr [[TMP2]], align 8
68 // CHECK1-NEXT: [[TMP3:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
69 // CHECK1-NEXT: store ptr null, ptr [[TMP3]], align 8
70 // CHECK1-NEXT: [[TMP4:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
71 // CHECK1-NEXT: store ptr null, ptr [[TMP4]], align 8
72 // CHECK1-NEXT: [[TMP5:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
73 // CHECK1-NEXT: store ptr null, ptr [[TMP5]], align 8
74 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
75 // CHECK1-NEXT: store ptr null, ptr [[TMP6]], align 8
76 // CHECK1-NEXT: [[TMP7:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
77 // CHECK1-NEXT: store ptr null, ptr [[TMP7]], align 8
78 // CHECK1-NEXT: [[TMP8:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
79 // CHECK1-NEXT: store i64 1000, ptr [[TMP8]], align 8
80 // CHECK1-NEXT: [[TMP9:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
81 // CHECK1-NEXT: store i64 0, ptr [[TMP9]], align 8
82 // CHECK1-NEXT: [[TMP10:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
83 // CHECK1-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP10]], align 4
84 // CHECK1-NEXT: [[TMP11:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
85 // CHECK1-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP11]], align 4
86 // CHECK1-NEXT: [[TMP12:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
87 // CHECK1-NEXT: store i32 0, ptr [[TMP12]], align 4
88 // CHECK1-NEXT: [[TMP13:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB3:[0-9]+]], i64 -1, i32 0, i32 0, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l36.region_id, ptr [[KERNEL_ARGS]])
89 // CHECK1-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
90 // CHECK1-NEXT: br i1 [[TMP14]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
91 // CHECK1: omp_offload.failed:
92 // CHECK1-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l36() #[[ATTR2:[0-9]+]]
93 // CHECK1-NEXT: br label [[OMP_OFFLOAD_CONT]]
94 // CHECK1: omp_offload.cont:
95 // CHECK1-NEXT: [[TMP15:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS2]], i32 0, i32 0
96 // CHECK1-NEXT: store i32 3, ptr [[TMP15]], align 4
97 // CHECK1-NEXT: [[TMP16:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS2]], i32 0, i32 1
98 // CHECK1-NEXT: store i32 0, ptr [[TMP16]], align 4
99 // CHECK1-NEXT: [[TMP17:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS2]], i32 0, i32 2
100 // CHECK1-NEXT: store ptr null, ptr [[TMP17]], align 8
101 // CHECK1-NEXT: [[TMP18:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS2]], i32 0, i32 3
102 // CHECK1-NEXT: store ptr null, ptr [[TMP18]], align 8
103 // CHECK1-NEXT: [[TMP19:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS2]], i32 0, i32 4
104 // CHECK1-NEXT: store ptr null, ptr [[TMP19]], align 8
105 // CHECK1-NEXT: [[TMP20:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS2]], i32 0, i32 5
106 // CHECK1-NEXT: store ptr null, ptr [[TMP20]], align 8
107 // CHECK1-NEXT: [[TMP21:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS2]], i32 0, i32 6
108 // CHECK1-NEXT: store ptr null, ptr [[TMP21]], align 8
109 // CHECK1-NEXT: [[TMP22:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS2]], i32 0, i32 7
110 // CHECK1-NEXT: store ptr null, ptr [[TMP22]], align 8
111 // CHECK1-NEXT: [[TMP23:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS2]], i32 0, i32 8
112 // CHECK1-NEXT: store i64 1000, ptr [[TMP23]], align 8
113 // CHECK1-NEXT: [[TMP24:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS2]], i32 0, i32 9
114 // CHECK1-NEXT: store i64 0, ptr [[TMP24]], align 8
115 // CHECK1-NEXT: [[TMP25:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS2]], i32 0, i32 10
116 // CHECK1-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP25]], align 4
117 // CHECK1-NEXT: [[TMP26:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS2]], i32 0, i32 11
118 // CHECK1-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP26]], align 4
119 // CHECK1-NEXT: [[TMP27:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS2]], i32 0, i32 12
120 // CHECK1-NEXT: store i32 0, ptr [[TMP27]], align 4
121 // CHECK1-NEXT: [[TMP28:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB3]], i64 -1, i32 0, i32 0, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l39.region_id, ptr [[KERNEL_ARGS2]])
122 // CHECK1-NEXT: [[TMP29:%.*]] = icmp ne i32 [[TMP28]], 0
123 // CHECK1-NEXT: br i1 [[TMP29]], label [[OMP_OFFLOAD_FAILED3:%.*]], label [[OMP_OFFLOAD_CONT4:%.*]]
124 // CHECK1: omp_offload.failed3:
125 // CHECK1-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l39() #[[ATTR2]]
126 // CHECK1-NEXT: br label [[OMP_OFFLOAD_CONT4]]
127 // CHECK1: omp_offload.cont4:
128 // CHECK1-NEXT: [[CALL:%.*]] = call noundef signext i32 @_Z5tmainIiET_v()
129 // CHECK1-NEXT: ret i32 [[CALL]]
132 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l36
133 // CHECK1-SAME: () #[[ATTR1:[0-9]+]] {
134 // CHECK1-NEXT: entry:
135 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB3]], i32 0, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l36.omp_outlined)
136 // CHECK1-NEXT: ret void
139 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l36.omp_outlined
140 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]]) #[[ATTR1]] {
141 // CHECK1-NEXT: entry:
142 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
143 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
144 // CHECK1-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
145 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
146 // CHECK1-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
147 // CHECK1-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
148 // CHECK1-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
149 // CHECK1-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
150 // CHECK1-NEXT: [[I:%.*]] = alloca i32, align 4
151 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
152 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
153 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
154 // CHECK1-NEXT: store i32 999, ptr [[DOTOMP_COMB_UB]], align 4
155 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
156 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
157 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
158 // CHECK1-NEXT: [[TMP1:%.*]] = load i32, ptr [[TMP0]], align 4
159 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1:[0-9]+]], i32 [[TMP1]], i32 92, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_COMB_LB]], ptr [[DOTOMP_COMB_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
160 // CHECK1-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
161 // CHECK1-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP2]], 999
162 // CHECK1-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
163 // CHECK1: cond.true:
164 // CHECK1-NEXT: br label [[COND_END:%.*]]
165 // CHECK1: cond.false:
166 // CHECK1-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
167 // CHECK1-NEXT: br label [[COND_END]]
169 // CHECK1-NEXT: [[COND:%.*]] = phi i32 [ 999, [[COND_TRUE]] ], [ [[TMP3]], [[COND_FALSE]] ]
170 // CHECK1-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
171 // CHECK1-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
172 // CHECK1-NEXT: store i32 [[TMP4]], ptr [[DOTOMP_IV]], align 4
173 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
174 // CHECK1: omp.inner.for.cond:
175 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
176 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
177 // CHECK1-NEXT: [[CMP1:%.*]] = icmp sle i32 [[TMP5]], [[TMP6]]
178 // CHECK1-NEXT: br i1 [[CMP1]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
179 // CHECK1: omp.inner.for.body:
180 // CHECK1-NEXT: call void @__kmpc_push_proc_bind(ptr @[[GLOB3]], i32 [[TMP1]], i32 4)
181 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
182 // CHECK1-NEXT: [[TMP8:%.*]] = zext i32 [[TMP7]] to i64
183 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
184 // CHECK1-NEXT: [[TMP10:%.*]] = zext i32 [[TMP9]] to i64
185 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB3]], i32 2, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l36.omp_outlined.omp_outlined, i64 [[TMP8]], i64 [[TMP10]])
186 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
187 // CHECK1: omp.inner.for.inc:
188 // CHECK1-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
189 // CHECK1-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_STRIDE]], align 4
190 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP11]], [[TMP12]]
191 // CHECK1-NEXT: store i32 [[ADD]], ptr [[DOTOMP_IV]], align 4
192 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]]
193 // CHECK1: omp.inner.for.end:
194 // CHECK1-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
195 // CHECK1: omp.loop.exit:
196 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP1]])
197 // CHECK1-NEXT: ret void
200 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l36.omp_outlined.omp_outlined
201 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], i64 noundef [[DOTPREVIOUS_LB_:%.*]], i64 noundef [[DOTPREVIOUS_UB_:%.*]]) #[[ATTR1]] {
202 // CHECK1-NEXT: entry:
203 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
204 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
205 // CHECK1-NEXT: [[DOTPREVIOUS_LB__ADDR:%.*]] = alloca i64, align 8
206 // CHECK1-NEXT: [[DOTPREVIOUS_UB__ADDR:%.*]] = alloca i64, align 8
207 // CHECK1-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
208 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
209 // CHECK1-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
210 // CHECK1-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
211 // CHECK1-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
212 // CHECK1-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
213 // CHECK1-NEXT: [[I:%.*]] = alloca i32, align 4
214 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
215 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
216 // CHECK1-NEXT: store i64 [[DOTPREVIOUS_LB_]], ptr [[DOTPREVIOUS_LB__ADDR]], align 8
217 // CHECK1-NEXT: store i64 [[DOTPREVIOUS_UB_]], ptr [[DOTPREVIOUS_UB__ADDR]], align 8
218 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
219 // CHECK1-NEXT: store i32 999, ptr [[DOTOMP_UB]], align 4
220 // CHECK1-NEXT: [[TMP0:%.*]] = load i64, ptr [[DOTPREVIOUS_LB__ADDR]], align 8
221 // CHECK1-NEXT: [[CONV:%.*]] = trunc i64 [[TMP0]] to i32
222 // CHECK1-NEXT: [[TMP1:%.*]] = load i64, ptr [[DOTPREVIOUS_UB__ADDR]], align 8
223 // CHECK1-NEXT: [[CONV1:%.*]] = trunc i64 [[TMP1]] to i32
224 // CHECK1-NEXT: store i32 [[CONV]], ptr [[DOTOMP_LB]], align 4
225 // CHECK1-NEXT: store i32 [[CONV1]], ptr [[DOTOMP_UB]], align 4
226 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
227 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
228 // CHECK1-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
229 // CHECK1-NEXT: [[TMP3:%.*]] = load i32, ptr [[TMP2]], align 4
230 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB2:[0-9]+]], i32 [[TMP3]], i32 34, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_LB]], ptr [[DOTOMP_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
231 // CHECK1-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
232 // CHECK1-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP4]], 999
233 // CHECK1-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
234 // CHECK1: cond.true:
235 // CHECK1-NEXT: br label [[COND_END:%.*]]
236 // CHECK1: cond.false:
237 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
238 // CHECK1-NEXT: br label [[COND_END]]
240 // CHECK1-NEXT: [[COND:%.*]] = phi i32 [ 999, [[COND_TRUE]] ], [ [[TMP5]], [[COND_FALSE]] ]
241 // CHECK1-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
242 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
243 // CHECK1-NEXT: store i32 [[TMP6]], ptr [[DOTOMP_IV]], align 4
244 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
245 // CHECK1: omp.inner.for.cond:
246 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
247 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
248 // CHECK1-NEXT: [[CMP2:%.*]] = icmp sle i32 [[TMP7]], [[TMP8]]
249 // CHECK1-NEXT: br i1 [[CMP2]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
250 // CHECK1: omp.inner.for.body:
251 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
252 // CHECK1-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP9]], 1
253 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
254 // CHECK1-NEXT: store i32 [[ADD]], ptr [[I]], align 4
255 // CHECK1-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
256 // CHECK1: omp.body.continue:
257 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
258 // CHECK1: omp.inner.for.inc:
259 // CHECK1-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
260 // CHECK1-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP10]], 1
261 // CHECK1-NEXT: store i32 [[ADD3]], ptr [[DOTOMP_IV]], align 4
262 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]]
263 // CHECK1: omp.inner.for.end:
264 // CHECK1-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
265 // CHECK1: omp.loop.exit:
266 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB2]], i32 [[TMP3]])
267 // CHECK1-NEXT: ret void
270 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l39
271 // CHECK1-SAME: () #[[ATTR1]] {
272 // CHECK1-NEXT: entry:
273 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB3]], i32 0, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l39.omp_outlined)
274 // CHECK1-NEXT: ret void
277 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l39.omp_outlined
278 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]]) #[[ATTR1]] {
279 // CHECK1-NEXT: entry:
280 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
281 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
282 // CHECK1-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
283 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
284 // CHECK1-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
285 // CHECK1-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
286 // CHECK1-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
287 // CHECK1-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
288 // CHECK1-NEXT: [[I:%.*]] = alloca i32, align 4
289 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
290 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
291 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
292 // CHECK1-NEXT: store i32 999, ptr [[DOTOMP_COMB_UB]], align 4
293 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
294 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
295 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
296 // CHECK1-NEXT: [[TMP1:%.*]] = load i32, ptr [[TMP0]], align 4
297 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1]], i32 [[TMP1]], i32 92, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_COMB_LB]], ptr [[DOTOMP_COMB_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
298 // CHECK1-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
299 // CHECK1-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP2]], 999
300 // CHECK1-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
301 // CHECK1: cond.true:
302 // CHECK1-NEXT: br label [[COND_END:%.*]]
303 // CHECK1: cond.false:
304 // CHECK1-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
305 // CHECK1-NEXT: br label [[COND_END]]
307 // CHECK1-NEXT: [[COND:%.*]] = phi i32 [ 999, [[COND_TRUE]] ], [ [[TMP3]], [[COND_FALSE]] ]
308 // CHECK1-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
309 // CHECK1-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
310 // CHECK1-NEXT: store i32 [[TMP4]], ptr [[DOTOMP_IV]], align 4
311 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
312 // CHECK1: omp.inner.for.cond:
313 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
314 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
315 // CHECK1-NEXT: [[CMP1:%.*]] = icmp sle i32 [[TMP5]], [[TMP6]]
316 // CHECK1-NEXT: br i1 [[CMP1]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
317 // CHECK1: omp.inner.for.body:
318 // CHECK1-NEXT: call void @__kmpc_push_proc_bind(ptr @[[GLOB3]], i32 [[TMP1]], i32 3)
319 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
320 // CHECK1-NEXT: [[TMP8:%.*]] = zext i32 [[TMP7]] to i64
321 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
322 // CHECK1-NEXT: [[TMP10:%.*]] = zext i32 [[TMP9]] to i64
323 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB3]], i32 2, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l39.omp_outlined.omp_outlined, i64 [[TMP8]], i64 [[TMP10]])
324 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
325 // CHECK1: omp.inner.for.inc:
326 // CHECK1-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
327 // CHECK1-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_STRIDE]], align 4
328 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP11]], [[TMP12]]
329 // CHECK1-NEXT: store i32 [[ADD]], ptr [[DOTOMP_IV]], align 4
330 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]]
331 // CHECK1: omp.inner.for.end:
332 // CHECK1-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
333 // CHECK1: omp.loop.exit:
334 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP1]])
335 // CHECK1-NEXT: ret void
338 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}_main_l39.omp_outlined.omp_outlined
339 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], i64 noundef [[DOTPREVIOUS_LB_:%.*]], i64 noundef [[DOTPREVIOUS_UB_:%.*]]) #[[ATTR1]] {
340 // CHECK1-NEXT: entry:
341 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
342 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
343 // CHECK1-NEXT: [[DOTPREVIOUS_LB__ADDR:%.*]] = alloca i64, align 8
344 // CHECK1-NEXT: [[DOTPREVIOUS_UB__ADDR:%.*]] = alloca i64, align 8
345 // CHECK1-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
346 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
347 // CHECK1-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
348 // CHECK1-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
349 // CHECK1-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
350 // CHECK1-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
351 // CHECK1-NEXT: [[I:%.*]] = alloca i32, align 4
352 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
353 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
354 // CHECK1-NEXT: store i64 [[DOTPREVIOUS_LB_]], ptr [[DOTPREVIOUS_LB__ADDR]], align 8
355 // CHECK1-NEXT: store i64 [[DOTPREVIOUS_UB_]], ptr [[DOTPREVIOUS_UB__ADDR]], align 8
356 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
357 // CHECK1-NEXT: store i32 999, ptr [[DOTOMP_UB]], align 4
358 // CHECK1-NEXT: [[TMP0:%.*]] = load i64, ptr [[DOTPREVIOUS_LB__ADDR]], align 8
359 // CHECK1-NEXT: [[CONV:%.*]] = trunc i64 [[TMP0]] to i32
360 // CHECK1-NEXT: [[TMP1:%.*]] = load i64, ptr [[DOTPREVIOUS_UB__ADDR]], align 8
361 // CHECK1-NEXT: [[CONV1:%.*]] = trunc i64 [[TMP1]] to i32
362 // CHECK1-NEXT: store i32 [[CONV]], ptr [[DOTOMP_LB]], align 4
363 // CHECK1-NEXT: store i32 [[CONV1]], ptr [[DOTOMP_UB]], align 4
364 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
365 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
366 // CHECK1-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
367 // CHECK1-NEXT: [[TMP3:%.*]] = load i32, ptr [[TMP2]], align 4
368 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB2]], i32 [[TMP3]], i32 34, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_LB]], ptr [[DOTOMP_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
369 // CHECK1-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
370 // CHECK1-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP4]], 999
371 // CHECK1-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
372 // CHECK1: cond.true:
373 // CHECK1-NEXT: br label [[COND_END:%.*]]
374 // CHECK1: cond.false:
375 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
376 // CHECK1-NEXT: br label [[COND_END]]
378 // CHECK1-NEXT: [[COND:%.*]] = phi i32 [ 999, [[COND_TRUE]] ], [ [[TMP5]], [[COND_FALSE]] ]
379 // CHECK1-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
380 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
381 // CHECK1-NEXT: store i32 [[TMP6]], ptr [[DOTOMP_IV]], align 4
382 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
383 // CHECK1: omp.inner.for.cond:
384 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
385 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
386 // CHECK1-NEXT: [[CMP2:%.*]] = icmp sle i32 [[TMP7]], [[TMP8]]
387 // CHECK1-NEXT: br i1 [[CMP2]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
388 // CHECK1: omp.inner.for.body:
389 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
390 // CHECK1-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP9]], 1
391 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
392 // CHECK1-NEXT: store i32 [[ADD]], ptr [[I]], align 4
393 // CHECK1-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
394 // CHECK1: omp.body.continue:
395 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
396 // CHECK1: omp.inner.for.inc:
397 // CHECK1-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
398 // CHECK1-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP10]], 1
399 // CHECK1-NEXT: store i32 [[ADD3]], ptr [[DOTOMP_IV]], align 4
400 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]]
401 // CHECK1: omp.inner.for.end:
402 // CHECK1-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
403 // CHECK1: omp.loop.exit:
404 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB2]], i32 [[TMP3]])
405 // CHECK1-NEXT: ret void
408 // CHECK1-LABEL: define {{[^@]+}}@_Z5tmainIiET_v
409 // CHECK1-SAME: () #[[ATTR3:[0-9]+]] comdat {
410 // CHECK1-NEXT: entry:
411 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
412 // CHECK1-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
413 // CHECK1-NEXT: [[TMP0:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
414 // CHECK1-NEXT: store i32 3, ptr [[TMP0]], align 4
415 // CHECK1-NEXT: [[TMP1:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
416 // CHECK1-NEXT: store i32 0, ptr [[TMP1]], align 4
417 // CHECK1-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
418 // CHECK1-NEXT: store ptr null, ptr [[TMP2]], align 8
419 // CHECK1-NEXT: [[TMP3:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
420 // CHECK1-NEXT: store ptr null, ptr [[TMP3]], align 8
421 // CHECK1-NEXT: [[TMP4:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
422 // CHECK1-NEXT: store ptr null, ptr [[TMP4]], align 8
423 // CHECK1-NEXT: [[TMP5:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
424 // CHECK1-NEXT: store ptr null, ptr [[TMP5]], align 8
425 // CHECK1-NEXT: [[TMP6:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
426 // CHECK1-NEXT: store ptr null, ptr [[TMP6]], align 8
427 // CHECK1-NEXT: [[TMP7:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
428 // CHECK1-NEXT: store ptr null, ptr [[TMP7]], align 8
429 // CHECK1-NEXT: [[TMP8:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
430 // CHECK1-NEXT: store i64 1000, ptr [[TMP8]], align 8
431 // CHECK1-NEXT: [[TMP9:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
432 // CHECK1-NEXT: store i64 0, ptr [[TMP9]], align 8
433 // CHECK1-NEXT: [[TMP10:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
434 // CHECK1-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP10]], align 4
435 // CHECK1-NEXT: [[TMP11:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
436 // CHECK1-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP11]], align 4
437 // CHECK1-NEXT: [[TMP12:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
438 // CHECK1-NEXT: store i32 0, ptr [[TMP12]], align 4
439 // CHECK1-NEXT: [[TMP13:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB3]], i64 -1, i32 0, i32 0, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l29.region_id, ptr [[KERNEL_ARGS]])
440 // CHECK1-NEXT: [[TMP14:%.*]] = icmp ne i32 [[TMP13]], 0
441 // CHECK1-NEXT: br i1 [[TMP14]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
442 // CHECK1: omp_offload.failed:
443 // CHECK1-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l29() #[[ATTR2]]
444 // CHECK1-NEXT: br label [[OMP_OFFLOAD_CONT]]
445 // CHECK1: omp_offload.cont:
446 // CHECK1-NEXT: ret i32 0
449 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l29
450 // CHECK1-SAME: () #[[ATTR1]] {
451 // CHECK1-NEXT: entry:
452 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB3]], i32 0, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l29.omp_outlined)
453 // CHECK1-NEXT: ret void
456 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l29.omp_outlined
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_IV:%.*]] = alloca i32, align 4
462 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
463 // CHECK1-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
464 // CHECK1-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
465 // CHECK1-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
466 // CHECK1-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
467 // CHECK1-NEXT: [[I:%.*]] = alloca i32, align 4
468 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
469 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
470 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
471 // CHECK1-NEXT: store i32 999, ptr [[DOTOMP_COMB_UB]], align 4
472 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
473 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
474 // CHECK1-NEXT: [[TMP0:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
475 // CHECK1-NEXT: [[TMP1:%.*]] = load i32, ptr [[TMP0]], align 4
476 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1]], i32 [[TMP1]], i32 92, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_COMB_LB]], ptr [[DOTOMP_COMB_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
477 // CHECK1-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
478 // CHECK1-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP2]], 999
479 // CHECK1-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
480 // CHECK1: cond.true:
481 // CHECK1-NEXT: br label [[COND_END:%.*]]
482 // CHECK1: cond.false:
483 // CHECK1-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
484 // CHECK1-NEXT: br label [[COND_END]]
486 // CHECK1-NEXT: [[COND:%.*]] = phi i32 [ 999, [[COND_TRUE]] ], [ [[TMP3]], [[COND_FALSE]] ]
487 // CHECK1-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
488 // CHECK1-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
489 // CHECK1-NEXT: store i32 [[TMP4]], ptr [[DOTOMP_IV]], align 4
490 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
491 // CHECK1: omp.inner.for.cond:
492 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
493 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
494 // CHECK1-NEXT: [[CMP1:%.*]] = icmp sle i32 [[TMP5]], [[TMP6]]
495 // CHECK1-NEXT: br i1 [[CMP1]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
496 // CHECK1: omp.inner.for.body:
497 // CHECK1-NEXT: call void @__kmpc_push_proc_bind(ptr @[[GLOB3]], i32 [[TMP1]], i32 2)
498 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
499 // CHECK1-NEXT: [[TMP8:%.*]] = zext i32 [[TMP7]] to i64
500 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
501 // CHECK1-NEXT: [[TMP10:%.*]] = zext i32 [[TMP9]] to i64
502 // CHECK1-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB3]], i32 2, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l29.omp_outlined.omp_outlined, i64 [[TMP8]], i64 [[TMP10]])
503 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
504 // CHECK1: omp.inner.for.inc:
505 // CHECK1-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
506 // CHECK1-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_STRIDE]], align 4
507 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP11]], [[TMP12]]
508 // CHECK1-NEXT: store i32 [[ADD]], ptr [[DOTOMP_IV]], align 4
509 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]]
510 // CHECK1: omp.inner.for.end:
511 // CHECK1-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
512 // CHECK1: omp.loop.exit:
513 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP1]])
514 // CHECK1-NEXT: ret void
517 // CHECK1-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z5tmainIiET_v_l29.omp_outlined.omp_outlined
518 // CHECK1-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], i64 noundef [[DOTPREVIOUS_LB_:%.*]], i64 noundef [[DOTPREVIOUS_UB_:%.*]]) #[[ATTR1]] {
519 // CHECK1-NEXT: entry:
520 // CHECK1-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
521 // CHECK1-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
522 // CHECK1-NEXT: [[DOTPREVIOUS_LB__ADDR:%.*]] = alloca i64, align 8
523 // CHECK1-NEXT: [[DOTPREVIOUS_UB__ADDR:%.*]] = alloca i64, align 8
524 // CHECK1-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
525 // CHECK1-NEXT: [[TMP:%.*]] = alloca i32, align 4
526 // CHECK1-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
527 // CHECK1-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
528 // CHECK1-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
529 // CHECK1-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
530 // CHECK1-NEXT: [[I:%.*]] = alloca i32, align 4
531 // CHECK1-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
532 // CHECK1-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
533 // CHECK1-NEXT: store i64 [[DOTPREVIOUS_LB_]], ptr [[DOTPREVIOUS_LB__ADDR]], align 8
534 // CHECK1-NEXT: store i64 [[DOTPREVIOUS_UB_]], ptr [[DOTPREVIOUS_UB__ADDR]], align 8
535 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
536 // CHECK1-NEXT: store i32 999, ptr [[DOTOMP_UB]], align 4
537 // CHECK1-NEXT: [[TMP0:%.*]] = load i64, ptr [[DOTPREVIOUS_LB__ADDR]], align 8
538 // CHECK1-NEXT: [[CONV:%.*]] = trunc i64 [[TMP0]] to i32
539 // CHECK1-NEXT: [[TMP1:%.*]] = load i64, ptr [[DOTPREVIOUS_UB__ADDR]], align 8
540 // CHECK1-NEXT: [[CONV1:%.*]] = trunc i64 [[TMP1]] to i32
541 // CHECK1-NEXT: store i32 [[CONV]], ptr [[DOTOMP_LB]], align 4
542 // CHECK1-NEXT: store i32 [[CONV1]], ptr [[DOTOMP_UB]], align 4
543 // CHECK1-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
544 // CHECK1-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
545 // CHECK1-NEXT: [[TMP2:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
546 // CHECK1-NEXT: [[TMP3:%.*]] = load i32, ptr [[TMP2]], align 4
547 // CHECK1-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB2]], i32 [[TMP3]], i32 34, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_LB]], ptr [[DOTOMP_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
548 // CHECK1-NEXT: [[TMP4:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
549 // CHECK1-NEXT: [[CMP:%.*]] = icmp sgt i32 [[TMP4]], 999
550 // CHECK1-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
551 // CHECK1: cond.true:
552 // CHECK1-NEXT: br label [[COND_END:%.*]]
553 // CHECK1: cond.false:
554 // CHECK1-NEXT: [[TMP5:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
555 // CHECK1-NEXT: br label [[COND_END]]
557 // CHECK1-NEXT: [[COND:%.*]] = phi i32 [ 999, [[COND_TRUE]] ], [ [[TMP5]], [[COND_FALSE]] ]
558 // CHECK1-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
559 // CHECK1-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
560 // CHECK1-NEXT: store i32 [[TMP6]], ptr [[DOTOMP_IV]], align 4
561 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
562 // CHECK1: omp.inner.for.cond:
563 // CHECK1-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
564 // CHECK1-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
565 // CHECK1-NEXT: [[CMP2:%.*]] = icmp sle i32 [[TMP7]], [[TMP8]]
566 // CHECK1-NEXT: br i1 [[CMP2]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
567 // CHECK1: omp.inner.for.body:
568 // CHECK1-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
569 // CHECK1-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP9]], 1
570 // CHECK1-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
571 // CHECK1-NEXT: store i32 [[ADD]], ptr [[I]], align 4
572 // CHECK1-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
573 // CHECK1: omp.body.continue:
574 // CHECK1-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
575 // CHECK1: omp.inner.for.inc:
576 // CHECK1-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
577 // CHECK1-NEXT: [[ADD3:%.*]] = add nsw i32 [[TMP10]], 1
578 // CHECK1-NEXT: store i32 [[ADD3]], ptr [[DOTOMP_IV]], align 4
579 // CHECK1-NEXT: br label [[OMP_INNER_FOR_COND]]
580 // CHECK1: omp.inner.for.end:
581 // CHECK1-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
582 // CHECK1: omp.loop.exit:
583 // CHECK1-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB2]], i32 [[TMP3]])
584 // CHECK1-NEXT: ret void