1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --include-generated-funcs --replace-value-regex "__omp_offloading_[0-9a-z]+_[0-9a-z]+" "reduction_size[.].+[.]" "pl_cond[.].+[.|,]" --prefix-filecheck-ir-name _ --version 2
3 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s
4 // expected-no-diagnostics
6 int kernel_within_loop(int *a
, int *b
, int N
, int num_iters
) {
8 for (i
= 0; i
< num_iters
; ++i
) {
9 #pragma omp target parallel for map(a[0:N]) map(b[0:N])
10 for (int j
= 0; j
< N
; j
++)
13 #pragma omp target teams distribute parallel for map(a[0:N]) map(b[0:N])
14 for (int j
= 0; j
< N
; j
+=3)
19 // CHECK-LABEL: define dso_local noundef signext i32 @_Z18kernel_within_loopPiS_ii
20 // CHECK-SAME: (ptr noundef [[A:%.*]], ptr noundef [[B:%.*]], i32 noundef signext [[N:%.*]], i32 noundef signext [[NUM_ITERS:%.*]]) #[[ATTR0:[0-9]+]] {
22 // CHECK-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
23 // CHECK-NEXT: [[B_ADDR:%.*]] = alloca ptr, align 8
24 // CHECK-NEXT: [[N_ADDR:%.*]] = alloca i32, align 4
25 // CHECK-NEXT: [[NUM_ITERS_ADDR:%.*]] = alloca i32, align 4
26 // CHECK-NEXT: [[I:%.*]] = alloca i32, align 4
27 // CHECK-NEXT: [[N_CASTED:%.*]] = alloca i64, align 8
28 // CHECK-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [3 x ptr], align 8
29 // CHECK-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [3 x ptr], align 8
30 // CHECK-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [3 x ptr], align 8
31 // CHECK-NEXT: [[DOTOFFLOAD_SIZES:%.*]] = alloca [3 x i64], align 8
32 // CHECK-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
33 // CHECK-NEXT: [[N_CASTED3:%.*]] = alloca i64, align 8
34 // CHECK-NEXT: [[DOTOFFLOAD_BASEPTRS8:%.*]] = alloca [3 x ptr], align 8
35 // CHECK-NEXT: [[DOTOFFLOAD_PTRS9:%.*]] = alloca [3 x ptr], align 8
36 // CHECK-NEXT: [[DOTOFFLOAD_MAPPERS10:%.*]] = alloca [3 x ptr], align 8
37 // CHECK-NEXT: [[DOTOFFLOAD_SIZES11:%.*]] = alloca [3 x i64], align 8
38 // CHECK-NEXT: [[TMP:%.*]] = alloca i32, align 4
39 // CHECK-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
40 // CHECK-NEXT: [[DOTCAPTURE_EXPR_12:%.*]] = alloca i32, align 4
41 // CHECK-NEXT: [[KERNEL_ARGS14:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS]], align 8
42 // CHECK-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8
43 // CHECK-NEXT: store ptr [[B]], ptr [[B_ADDR]], align 8
44 // CHECK-NEXT: store i32 [[N]], ptr [[N_ADDR]], align 4
45 // CHECK-NEXT: store i32 [[NUM_ITERS]], ptr [[NUM_ITERS_ADDR]], align 4
46 // CHECK-NEXT: store i32 0, ptr [[I]], align 4
47 // CHECK-NEXT: br label [[FOR_COND:%.*]]
49 // CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[I]], align 4
50 // CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[NUM_ITERS_ADDR]], align 4
51 // CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[TMP0]], [[TMP1]]
52 // CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
54 // CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[N_ADDR]], align 4
55 // CHECK-NEXT: store i32 [[TMP2]], ptr [[N_CASTED]], align 4
56 // CHECK-NEXT: [[TMP3:%.*]] = load i64, ptr [[N_CASTED]], align 8
57 // CHECK-NEXT: [[TMP4:%.*]] = load ptr, ptr [[A_ADDR]], align 8
58 // CHECK-NEXT: [[TMP5:%.*]] = load ptr, ptr [[B_ADDR]], align 8
59 // CHECK-NEXT: [[TMP6:%.*]] = load ptr, ptr [[A_ADDR]], align 8
60 // CHECK-NEXT: [[TMP7:%.*]] = load ptr, ptr [[A_ADDR]], align 8
61 // CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds nuw i32, ptr [[TMP7]], i64 0
62 // CHECK-NEXT: [[TMP8:%.*]] = load i32, ptr [[N_ADDR]], align 4
63 // CHECK-NEXT: [[CONV:%.*]] = sext i32 [[TMP8]] to i64
64 // CHECK-NEXT: [[TMP9:%.*]] = mul nuw i64 [[CONV]], 4
65 // CHECK-NEXT: [[TMP10:%.*]] = load ptr, ptr [[B_ADDR]], align 8
66 // CHECK-NEXT: [[TMP11:%.*]] = load ptr, ptr [[B_ADDR]], align 8
67 // CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds nuw i32, ptr [[TMP11]], i64 0
68 // CHECK-NEXT: [[TMP12:%.*]] = load i32, ptr [[N_ADDR]], align 4
69 // CHECK-NEXT: [[CONV2:%.*]] = sext i32 [[TMP12]] to i64
70 // CHECK-NEXT: [[TMP13:%.*]] = mul nuw i64 [[CONV2]], 4
71 // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[DOTOFFLOAD_SIZES]], ptr align 8 @.offload_sizes, i64 24, i1 false)
72 // CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
73 // CHECK-NEXT: store i64 [[TMP3]], ptr [[TMP14]], align 8
74 // CHECK-NEXT: [[TMP15:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
75 // CHECK-NEXT: store i64 [[TMP3]], ptr [[TMP15]], align 8
76 // CHECK-NEXT: [[TMP16:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 0
77 // CHECK-NEXT: store ptr null, ptr [[TMP16]], align 8
78 // CHECK-NEXT: [[TMP17:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 1
79 // CHECK-NEXT: store ptr [[TMP6]], ptr [[TMP17]], align 8
80 // CHECK-NEXT: [[TMP18:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 1
81 // CHECK-NEXT: store ptr [[ARRAYIDX]], ptr [[TMP18]], align 8
82 // CHECK-NEXT: [[TMP19:%.*]] = getelementptr inbounds [3 x i64], ptr [[DOTOFFLOAD_SIZES]], i32 0, i32 1
83 // CHECK-NEXT: store i64 [[TMP9]], ptr [[TMP19]], align 8
84 // CHECK-NEXT: [[TMP20:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 1
85 // CHECK-NEXT: store ptr null, ptr [[TMP20]], align 8
86 // CHECK-NEXT: [[TMP21:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 2
87 // CHECK-NEXT: store ptr [[TMP10]], ptr [[TMP21]], align 8
88 // CHECK-NEXT: [[TMP22:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 2
89 // CHECK-NEXT: store ptr [[ARRAYIDX1]], ptr [[TMP22]], align 8
90 // CHECK-NEXT: [[TMP23:%.*]] = getelementptr inbounds [3 x i64], ptr [[DOTOFFLOAD_SIZES]], i32 0, i32 2
91 // CHECK-NEXT: store i64 [[TMP13]], ptr [[TMP23]], align 8
92 // CHECK-NEXT: [[TMP24:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 2
93 // CHECK-NEXT: store ptr null, ptr [[TMP24]], align 8
94 // CHECK-NEXT: [[TMP25:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
95 // CHECK-NEXT: [[TMP26:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
96 // CHECK-NEXT: [[TMP27:%.*]] = getelementptr inbounds [3 x i64], ptr [[DOTOFFLOAD_SIZES]], i32 0, i32 0
97 // CHECK-NEXT: [[TMP28:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
98 // CHECK-NEXT: store i32 3, ptr [[TMP28]], align 4
99 // CHECK-NEXT: [[TMP29:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
100 // CHECK-NEXT: store i32 3, ptr [[TMP29]], align 4
101 // CHECK-NEXT: [[TMP30:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
102 // CHECK-NEXT: store ptr [[TMP25]], ptr [[TMP30]], align 8
103 // CHECK-NEXT: [[TMP31:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
104 // CHECK-NEXT: store ptr [[TMP26]], ptr [[TMP31]], align 8
105 // CHECK-NEXT: [[TMP32:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
106 // CHECK-NEXT: store ptr [[TMP27]], ptr [[TMP32]], align 8
107 // CHECK-NEXT: [[TMP33:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
108 // CHECK-NEXT: store ptr @.offload_maptypes, ptr [[TMP33]], align 8
109 // CHECK-NEXT: [[TMP34:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
110 // CHECK-NEXT: store ptr null, ptr [[TMP34]], align 8
111 // CHECK-NEXT: [[TMP35:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
112 // CHECK-NEXT: store ptr null, ptr [[TMP35]], align 8
113 // CHECK-NEXT: [[TMP36:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
114 // CHECK-NEXT: store i64 0, ptr [[TMP36]], align 8
115 // CHECK-NEXT: [[TMP37:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
116 // CHECK-NEXT: store i64 0, ptr [[TMP37]], align 8
117 // CHECK-NEXT: [[TMP38:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
118 // CHECK-NEXT: store [3 x i32] [i32 1, i32 0, i32 0], ptr [[TMP38]], align 4
119 // CHECK-NEXT: [[TMP39:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
120 // CHECK-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP39]], align 4
121 // CHECK-NEXT: [[TMP40:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
122 // CHECK-NEXT: store i32 0, ptr [[TMP40]], align 4
123 // CHECK-NEXT: [[TMP41:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB2:[0-9]+]], i64 -1, i32 1, i32 0, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z18kernel_within_loopPiS_ii_l9.region_id, ptr [[KERNEL_ARGS]])
124 // CHECK-NEXT: [[TMP42:%.*]] = icmp ne i32 [[TMP41]], 0
125 // CHECK-NEXT: br i1 [[TMP42]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
126 // CHECK: omp_offload.failed:
127 // CHECK-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z18kernel_within_loopPiS_ii_l9(i64 [[TMP3]], ptr [[TMP4]], ptr [[TMP5]]) #[[ATTR2:[0-9]+]]
128 // CHECK-NEXT: br label [[OMP_OFFLOAD_CONT]]
129 // CHECK: omp_offload.cont:
130 // CHECK-NEXT: [[TMP43:%.*]] = load i32, ptr [[N_ADDR]], align 4
131 // CHECK-NEXT: store i32 [[TMP43]], ptr [[N_CASTED3]], align 4
132 // CHECK-NEXT: [[TMP44:%.*]] = load i64, ptr [[N_CASTED3]], align 8
133 // CHECK-NEXT: [[TMP45:%.*]] = load ptr, ptr [[A_ADDR]], align 8
134 // CHECK-NEXT: [[TMP46:%.*]] = load ptr, ptr [[B_ADDR]], align 8
135 // CHECK-NEXT: [[TMP47:%.*]] = load ptr, ptr [[A_ADDR]], align 8
136 // CHECK-NEXT: [[TMP48:%.*]] = load ptr, ptr [[A_ADDR]], align 8
137 // CHECK-NEXT: [[ARRAYIDX4:%.*]] = getelementptr inbounds nuw i32, ptr [[TMP48]], i64 0
138 // CHECK-NEXT: [[TMP49:%.*]] = load i32, ptr [[N_ADDR]], align 4
139 // CHECK-NEXT: [[CONV5:%.*]] = sext i32 [[TMP49]] to i64
140 // CHECK-NEXT: [[TMP50:%.*]] = mul nuw i64 [[CONV5]], 4
141 // CHECK-NEXT: [[TMP51:%.*]] = load ptr, ptr [[B_ADDR]], align 8
142 // CHECK-NEXT: [[TMP52:%.*]] = load ptr, ptr [[B_ADDR]], align 8
143 // CHECK-NEXT: [[ARRAYIDX6:%.*]] = getelementptr inbounds nuw i32, ptr [[TMP52]], i64 0
144 // CHECK-NEXT: [[TMP53:%.*]] = load i32, ptr [[N_ADDR]], align 4
145 // CHECK-NEXT: [[CONV7:%.*]] = sext i32 [[TMP53]] to i64
146 // CHECK-NEXT: [[TMP54:%.*]] = mul nuw i64 [[CONV7]], 4
147 // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 [[DOTOFFLOAD_SIZES11]], ptr align 8 @.offload_sizes.1, i64 24, i1 false)
148 // CHECK-NEXT: [[TMP55:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS8]], i32 0, i32 0
149 // CHECK-NEXT: store i64 [[TMP44]], ptr [[TMP55]], align 8
150 // CHECK-NEXT: [[TMP56:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS9]], i32 0, i32 0
151 // CHECK-NEXT: store i64 [[TMP44]], ptr [[TMP56]], align 8
152 // CHECK-NEXT: [[TMP57:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS10]], i64 0, i64 0
153 // CHECK-NEXT: store ptr null, ptr [[TMP57]], align 8
154 // CHECK-NEXT: [[TMP58:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS8]], i32 0, i32 1
155 // CHECK-NEXT: store ptr [[TMP47]], ptr [[TMP58]], align 8
156 // CHECK-NEXT: [[TMP59:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS9]], i32 0, i32 1
157 // CHECK-NEXT: store ptr [[ARRAYIDX4]], ptr [[TMP59]], align 8
158 // CHECK-NEXT: [[TMP60:%.*]] = getelementptr inbounds [3 x i64], ptr [[DOTOFFLOAD_SIZES11]], i32 0, i32 1
159 // CHECK-NEXT: store i64 [[TMP50]], ptr [[TMP60]], align 8
160 // CHECK-NEXT: [[TMP61:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS10]], i64 0, i64 1
161 // CHECK-NEXT: store ptr null, ptr [[TMP61]], align 8
162 // CHECK-NEXT: [[TMP62:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS8]], i32 0, i32 2
163 // CHECK-NEXT: store ptr [[TMP51]], ptr [[TMP62]], align 8
164 // CHECK-NEXT: [[TMP63:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS9]], i32 0, i32 2
165 // CHECK-NEXT: store ptr [[ARRAYIDX6]], ptr [[TMP63]], align 8
166 // CHECK-NEXT: [[TMP64:%.*]] = getelementptr inbounds [3 x i64], ptr [[DOTOFFLOAD_SIZES11]], i32 0, i32 2
167 // CHECK-NEXT: store i64 [[TMP54]], ptr [[TMP64]], align 8
168 // CHECK-NEXT: [[TMP65:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_MAPPERS10]], i64 0, i64 2
169 // CHECK-NEXT: store ptr null, ptr [[TMP65]], align 8
170 // CHECK-NEXT: [[TMP66:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_BASEPTRS8]], i32 0, i32 0
171 // CHECK-NEXT: [[TMP67:%.*]] = getelementptr inbounds [3 x ptr], ptr [[DOTOFFLOAD_PTRS9]], i32 0, i32 0
172 // CHECK-NEXT: [[TMP68:%.*]] = getelementptr inbounds [3 x i64], ptr [[DOTOFFLOAD_SIZES11]], i32 0, i32 0
173 // CHECK-NEXT: [[TMP69:%.*]] = load i32, ptr [[N_ADDR]], align 4
174 // CHECK-NEXT: store i32 [[TMP69]], ptr [[DOTCAPTURE_EXPR_]], align 4
175 // CHECK-NEXT: [[TMP70:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
176 // CHECK-NEXT: [[SUB:%.*]] = sub i32 [[TMP70]], -2
177 // CHECK-NEXT: [[DIV:%.*]] = udiv i32 [[SUB]], 3
178 // CHECK-NEXT: [[SUB13:%.*]] = sub i32 [[DIV]], 1
179 // CHECK-NEXT: store i32 [[SUB13]], ptr [[DOTCAPTURE_EXPR_12]], align 4
180 // CHECK-NEXT: [[TMP71:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_12]], align 4
181 // CHECK-NEXT: [[ADD:%.*]] = add i32 [[TMP71]], 1
182 // CHECK-NEXT: [[TMP72:%.*]] = zext i32 [[ADD]] to i64
183 // CHECK-NEXT: [[TMP73:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS14]], i32 0, i32 0
184 // CHECK-NEXT: store i32 3, ptr [[TMP73]], align 4
185 // CHECK-NEXT: [[TMP74:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS14]], i32 0, i32 1
186 // CHECK-NEXT: store i32 3, ptr [[TMP74]], align 4
187 // CHECK-NEXT: [[TMP75:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS14]], i32 0, i32 2
188 // CHECK-NEXT: store ptr [[TMP66]], ptr [[TMP75]], align 8
189 // CHECK-NEXT: [[TMP76:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS14]], i32 0, i32 3
190 // CHECK-NEXT: store ptr [[TMP67]], ptr [[TMP76]], align 8
191 // CHECK-NEXT: [[TMP77:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS14]], i32 0, i32 4
192 // CHECK-NEXT: store ptr [[TMP68]], ptr [[TMP77]], align 8
193 // CHECK-NEXT: [[TMP78:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS14]], i32 0, i32 5
194 // CHECK-NEXT: store ptr @.offload_maptypes.2, ptr [[TMP78]], align 8
195 // CHECK-NEXT: [[TMP79:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS14]], i32 0, i32 6
196 // CHECK-NEXT: store ptr null, ptr [[TMP79]], align 8
197 // CHECK-NEXT: [[TMP80:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS14]], i32 0, i32 7
198 // CHECK-NEXT: store ptr null, ptr [[TMP80]], align 8
199 // CHECK-NEXT: [[TMP81:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS14]], i32 0, i32 8
200 // CHECK-NEXT: store i64 [[TMP72]], ptr [[TMP81]], align 8
201 // CHECK-NEXT: [[TMP82:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS14]], i32 0, i32 9
202 // CHECK-NEXT: store i64 0, ptr [[TMP82]], align 8
203 // CHECK-NEXT: [[TMP83:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS14]], i32 0, i32 10
204 // CHECK-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP83]], align 4
205 // CHECK-NEXT: [[TMP84:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS14]], i32 0, i32 11
206 // CHECK-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP84]], align 4
207 // CHECK-NEXT: [[TMP85:%.*]] = getelementptr inbounds nuw [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS14]], i32 0, i32 12
208 // CHECK-NEXT: store i32 0, ptr [[TMP85]], align 4
209 // CHECK-NEXT: [[TMP86:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB2]], i64 -1, i32 0, i32 0, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z18kernel_within_loopPiS_ii_l13.region_id, ptr [[KERNEL_ARGS14]])
210 // CHECK-NEXT: [[TMP87:%.*]] = icmp ne i32 [[TMP86]], 0
211 // CHECK-NEXT: br i1 [[TMP87]], label [[OMP_OFFLOAD_FAILED15:%.*]], label [[OMP_OFFLOAD_CONT16:%.*]]
212 // CHECK: omp_offload.failed15:
213 // CHECK-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z18kernel_within_loopPiS_ii_l13(i64 [[TMP44]], ptr [[TMP45]], ptr [[TMP46]]) #[[ATTR2]]
214 // CHECK-NEXT: br label [[OMP_OFFLOAD_CONT16]]
215 // CHECK: omp_offload.cont16:
216 // CHECK-NEXT: br label [[FOR_INC:%.*]]
218 // CHECK-NEXT: [[TMP88:%.*]] = load i32, ptr [[I]], align 4
219 // CHECK-NEXT: [[INC:%.*]] = add nsw i32 [[TMP88]], 1
220 // CHECK-NEXT: store i32 [[INC]], ptr [[I]], align 4
221 // CHECK-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP5:![0-9]+]]
223 // CHECK-NEXT: [[TMP89:%.*]] = load ptr, ptr [[A_ADDR]], align 8
224 // CHECK-NEXT: [[TMP90:%.*]] = load i32, ptr [[N_ADDR]], align 4
225 // CHECK-NEXT: [[SUB17:%.*]] = sub nsw i32 [[TMP90]], 1
226 // CHECK-NEXT: [[IDXPROM:%.*]] = sext i32 [[SUB17]] to i64
227 // CHECK-NEXT: [[ARRAYIDX18:%.*]] = getelementptr inbounds i32, ptr [[TMP89]], i64 [[IDXPROM]]
228 // CHECK-NEXT: [[TMP91:%.*]] = load i32, ptr [[ARRAYIDX18]], align 4
229 // CHECK-NEXT: ret i32 [[TMP91]]
232 // CHECK-LABEL: define internal void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z18kernel_within_loopPiS_ii_l9
233 // CHECK-SAME: (i64 noundef [[N:%.*]], ptr noundef [[A:%.*]], ptr noundef [[B:%.*]]) #[[ATTR1:[0-9]+]] {
234 // CHECK-NEXT: entry:
235 // CHECK-NEXT: [[N_ADDR:%.*]] = alloca i64, align 8
236 // CHECK-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
237 // CHECK-NEXT: [[B_ADDR:%.*]] = alloca ptr, align 8
238 // CHECK-NEXT: [[N_CASTED:%.*]] = alloca i64, align 8
239 // CHECK-NEXT: store i64 [[N]], ptr [[N_ADDR]], align 8
240 // CHECK-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8
241 // CHECK-NEXT: store ptr [[B]], ptr [[B_ADDR]], align 8
242 // CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[N_ADDR]], align 4
243 // CHECK-NEXT: store i32 [[TMP0]], ptr [[N_CASTED]], align 4
244 // CHECK-NEXT: [[TMP1:%.*]] = load i64, ptr [[N_CASTED]], align 8
245 // CHECK-NEXT: [[TMP2:%.*]] = load ptr, ptr [[A_ADDR]], align 8
246 // CHECK-NEXT: [[TMP3:%.*]] = load ptr, ptr [[B_ADDR]], align 8
247 // CHECK-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB2]], i32 3, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z18kernel_within_loopPiS_ii_l9.omp_outlined, i64 [[TMP1]], ptr [[TMP2]], ptr [[TMP3]])
248 // CHECK-NEXT: ret void
251 // CHECK-LABEL: define internal void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z18kernel_within_loopPiS_ii_l9.omp_outlined
252 // CHECK-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], i64 noundef [[N:%.*]], ptr noundef [[A:%.*]], ptr noundef [[B:%.*]]) #[[ATTR1]] {
253 // CHECK-NEXT: entry:
254 // CHECK-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
255 // CHECK-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
256 // CHECK-NEXT: [[N_ADDR:%.*]] = alloca i64, align 8
257 // CHECK-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
258 // CHECK-NEXT: [[B_ADDR:%.*]] = alloca ptr, align 8
259 // CHECK-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
260 // CHECK-NEXT: [[TMP:%.*]] = alloca i32, align 4
261 // CHECK-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
262 // CHECK-NEXT: [[DOTCAPTURE_EXPR_1:%.*]] = alloca i32, align 4
263 // CHECK-NEXT: [[J:%.*]] = alloca i32, align 4
264 // CHECK-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
265 // CHECK-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
266 // CHECK-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
267 // CHECK-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
268 // CHECK-NEXT: [[J3:%.*]] = alloca i32, align 4
269 // CHECK-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
270 // CHECK-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
271 // CHECK-NEXT: store i64 [[N]], ptr [[N_ADDR]], align 8
272 // CHECK-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8
273 // CHECK-NEXT: store ptr [[B]], ptr [[B_ADDR]], align 8
274 // CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[N_ADDR]], align 4
275 // CHECK-NEXT: store i32 [[TMP0]], ptr [[DOTCAPTURE_EXPR_]], align 4
276 // CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
277 // CHECK-NEXT: [[SUB:%.*]] = sub nsw i32 [[TMP1]], 0
278 // CHECK-NEXT: [[DIV:%.*]] = sdiv i32 [[SUB]], 1
279 // CHECK-NEXT: [[SUB2:%.*]] = sub nsw i32 [[DIV]], 1
280 // CHECK-NEXT: store i32 [[SUB2]], ptr [[DOTCAPTURE_EXPR_1]], align 4
281 // CHECK-NEXT: store i32 0, ptr [[J]], align 4
282 // CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
283 // CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 0, [[TMP2]]
284 // CHECK-NEXT: br i1 [[CMP]], label [[OMP_PRECOND_THEN:%.*]], label [[OMP_PRECOND_END:%.*]]
285 // CHECK: omp.precond.then:
286 // CHECK-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
287 // CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
288 // CHECK-NEXT: store i32 [[TMP3]], ptr [[DOTOMP_UB]], align 4
289 // CHECK-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
290 // CHECK-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
291 // CHECK-NEXT: [[TMP4:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
292 // CHECK-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP4]], align 4
293 // CHECK-NEXT: call void @__kmpc_for_static_init_4(ptr @[[GLOB1:[0-9]+]], i32 [[TMP5]], i32 34, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_LB]], ptr [[DOTOMP_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
294 // CHECK-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
295 // CHECK-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
296 // CHECK-NEXT: [[CMP4:%.*]] = icmp sgt i32 [[TMP6]], [[TMP7]]
297 // CHECK-NEXT: br i1 [[CMP4]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
299 // CHECK-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
300 // CHECK-NEXT: br label [[COND_END:%.*]]
301 // CHECK: cond.false:
302 // CHECK-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
303 // CHECK-NEXT: br label [[COND_END]]
305 // CHECK-NEXT: [[COND:%.*]] = phi i32 [ [[TMP8]], [[COND_TRUE]] ], [ [[TMP9]], [[COND_FALSE]] ]
306 // CHECK-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
307 // CHECK-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
308 // CHECK-NEXT: store i32 [[TMP10]], ptr [[DOTOMP_IV]], align 4
309 // CHECK-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
310 // CHECK: omp.inner.for.cond:
311 // CHECK-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
312 // CHECK-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
313 // CHECK-NEXT: [[CMP5:%.*]] = icmp sle i32 [[TMP11]], [[TMP12]]
314 // CHECK-NEXT: br i1 [[CMP5]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
315 // CHECK: omp.inner.for.body:
316 // CHECK-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
317 // CHECK-NEXT: [[MUL:%.*]] = mul nsw i32 [[TMP13]], 1
318 // CHECK-NEXT: [[ADD:%.*]] = add nsw i32 0, [[MUL]]
319 // CHECK-NEXT: store i32 [[ADD]], ptr [[J3]], align 4
320 // CHECK-NEXT: [[TMP14:%.*]] = load ptr, ptr [[B_ADDR]], align 8
321 // CHECK-NEXT: [[TMP15:%.*]] = load i32, ptr [[J3]], align 4
322 // CHECK-NEXT: [[IDXPROM:%.*]] = sext i32 [[TMP15]] to i64
323 // CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[TMP14]], i64 [[IDXPROM]]
324 // CHECK-NEXT: [[TMP16:%.*]] = load i32, ptr [[ARRAYIDX]], align 4
325 // CHECK-NEXT: [[TMP17:%.*]] = load ptr, ptr [[A_ADDR]], align 8
326 // CHECK-NEXT: [[TMP18:%.*]] = load i32, ptr [[J3]], align 4
327 // CHECK-NEXT: [[IDXPROM6:%.*]] = sext i32 [[TMP18]] to i64
328 // CHECK-NEXT: [[ARRAYIDX7:%.*]] = getelementptr inbounds i32, ptr [[TMP17]], i64 [[IDXPROM6]]
329 // CHECK-NEXT: store i32 [[TMP16]], ptr [[ARRAYIDX7]], align 4
330 // CHECK-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
331 // CHECK: omp.body.continue:
332 // CHECK-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
333 // CHECK: omp.inner.for.inc:
334 // CHECK-NEXT: [[TMP19:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
335 // CHECK-NEXT: [[ADD8:%.*]] = add nsw i32 [[TMP19]], 1
336 // CHECK-NEXT: store i32 [[ADD8]], ptr [[DOTOMP_IV]], align 4
337 // CHECK-NEXT: br label [[OMP_INNER_FOR_COND]]
338 // CHECK: omp.inner.for.end:
339 // CHECK-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
340 // CHECK: omp.loop.exit:
341 // CHECK-NEXT: [[TMP20:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
342 // CHECK-NEXT: [[TMP21:%.*]] = load i32, ptr [[TMP20]], align 4
343 // CHECK-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP21]])
344 // CHECK-NEXT: br label [[OMP_PRECOND_END]]
345 // CHECK: omp.precond.end:
346 // CHECK-NEXT: ret void
349 // CHECK-LABEL: define internal void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z18kernel_within_loopPiS_ii_l13
350 // CHECK-SAME: (i64 noundef [[N:%.*]], ptr noundef [[A:%.*]], ptr noundef [[B:%.*]]) #[[ATTR1]] {
351 // CHECK-NEXT: entry:
352 // CHECK-NEXT: [[N_ADDR:%.*]] = alloca i64, align 8
353 // CHECK-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
354 // CHECK-NEXT: [[B_ADDR:%.*]] = alloca ptr, align 8
355 // CHECK-NEXT: [[N_CASTED:%.*]] = alloca i64, align 8
356 // CHECK-NEXT: store i64 [[N]], ptr [[N_ADDR]], align 8
357 // CHECK-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8
358 // CHECK-NEXT: store ptr [[B]], ptr [[B_ADDR]], align 8
359 // CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[N_ADDR]], align 4
360 // CHECK-NEXT: store i32 [[TMP0]], ptr [[N_CASTED]], align 4
361 // CHECK-NEXT: [[TMP1:%.*]] = load i64, ptr [[N_CASTED]], align 8
362 // CHECK-NEXT: [[TMP2:%.*]] = load ptr, ptr [[A_ADDR]], align 8
363 // CHECK-NEXT: [[TMP3:%.*]] = load ptr, ptr [[B_ADDR]], align 8
364 // CHECK-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_teams(ptr @[[GLOB2]], i32 3, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z18kernel_within_loopPiS_ii_l13.omp_outlined, i64 [[TMP1]], ptr [[TMP2]], ptr [[TMP3]])
365 // CHECK-NEXT: ret void
368 // CHECK-LABEL: define internal void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z18kernel_within_loopPiS_ii_l13.omp_outlined
369 // CHECK-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], i64 noundef [[N:%.*]], ptr noundef [[A:%.*]], ptr noundef [[B:%.*]]) #[[ATTR1]] {
370 // CHECK-NEXT: entry:
371 // CHECK-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
372 // CHECK-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
373 // CHECK-NEXT: [[N_ADDR:%.*]] = alloca i64, align 8
374 // CHECK-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
375 // CHECK-NEXT: [[B_ADDR:%.*]] = alloca ptr, align 8
376 // CHECK-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
377 // CHECK-NEXT: [[TMP:%.*]] = alloca i32, align 4
378 // CHECK-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
379 // CHECK-NEXT: [[DOTCAPTURE_EXPR_1:%.*]] = alloca i32, align 4
380 // CHECK-NEXT: [[J:%.*]] = alloca i32, align 4
381 // CHECK-NEXT: [[DOTOMP_COMB_LB:%.*]] = alloca i32, align 4
382 // CHECK-NEXT: [[DOTOMP_COMB_UB:%.*]] = alloca i32, align 4
383 // CHECK-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
384 // CHECK-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
385 // CHECK-NEXT: [[J3:%.*]] = alloca i32, align 4
386 // CHECK-NEXT: [[N_CASTED:%.*]] = alloca i64, align 8
387 // CHECK-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
388 // CHECK-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
389 // CHECK-NEXT: store i64 [[N]], ptr [[N_ADDR]], align 8
390 // CHECK-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8
391 // CHECK-NEXT: store ptr [[B]], ptr [[B_ADDR]], align 8
392 // CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[N_ADDR]], align 4
393 // CHECK-NEXT: store i32 [[TMP0]], ptr [[DOTCAPTURE_EXPR_]], align 4
394 // CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
395 // CHECK-NEXT: [[SUB:%.*]] = sub i32 [[TMP1]], -2
396 // CHECK-NEXT: [[DIV:%.*]] = udiv i32 [[SUB]], 3
397 // CHECK-NEXT: [[SUB2:%.*]] = sub i32 [[DIV]], 1
398 // CHECK-NEXT: store i32 [[SUB2]], ptr [[DOTCAPTURE_EXPR_1]], align 4
399 // CHECK-NEXT: store i32 0, ptr [[J]], align 4
400 // CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
401 // CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 0, [[TMP2]]
402 // CHECK-NEXT: br i1 [[CMP]], label [[OMP_PRECOND_THEN:%.*]], label [[OMP_PRECOND_END:%.*]]
403 // CHECK: omp.precond.then:
404 // CHECK-NEXT: store i32 0, ptr [[DOTOMP_COMB_LB]], align 4
405 // CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
406 // CHECK-NEXT: store i32 [[TMP3]], ptr [[DOTOMP_COMB_UB]], align 4
407 // CHECK-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
408 // CHECK-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
409 // CHECK-NEXT: [[TMP4:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
410 // CHECK-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP4]], align 4
411 // CHECK-NEXT: call void @__kmpc_for_static_init_4u(ptr @[[GLOB3:[0-9]+]], i32 [[TMP5]], i32 92, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_COMB_LB]], ptr [[DOTOMP_COMB_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
412 // CHECK-NEXT: [[TMP6:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
413 // CHECK-NEXT: [[TMP7:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
414 // CHECK-NEXT: [[CMP4:%.*]] = icmp ugt i32 [[TMP6]], [[TMP7]]
415 // CHECK-NEXT: br i1 [[CMP4]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
417 // CHECK-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
418 // CHECK-NEXT: br label [[COND_END:%.*]]
419 // CHECK: cond.false:
420 // CHECK-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
421 // CHECK-NEXT: br label [[COND_END]]
423 // CHECK-NEXT: [[COND:%.*]] = phi i32 [ [[TMP8]], [[COND_TRUE]] ], [ [[TMP9]], [[COND_FALSE]] ]
424 // CHECK-NEXT: store i32 [[COND]], ptr [[DOTOMP_COMB_UB]], align 4
425 // CHECK-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
426 // CHECK-NEXT: store i32 [[TMP10]], ptr [[DOTOMP_IV]], align 4
427 // CHECK-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
428 // CHECK: omp.inner.for.cond:
429 // CHECK-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
430 // CHECK-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
431 // CHECK-NEXT: [[ADD:%.*]] = add i32 [[TMP12]], 1
432 // CHECK-NEXT: [[CMP5:%.*]] = icmp ult i32 [[TMP11]], [[ADD]]
433 // CHECK-NEXT: br i1 [[CMP5]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
434 // CHECK: omp.inner.for.body:
435 // CHECK-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_COMB_LB]], align 4
436 // CHECK-NEXT: [[TMP14:%.*]] = zext i32 [[TMP13]] to i64
437 // CHECK-NEXT: [[TMP15:%.*]] = load i32, ptr [[DOTOMP_COMB_UB]], align 4
438 // CHECK-NEXT: [[TMP16:%.*]] = zext i32 [[TMP15]] to i64
439 // CHECK-NEXT: [[TMP17:%.*]] = load i32, ptr [[N_ADDR]], align 4
440 // CHECK-NEXT: store i32 [[TMP17]], ptr [[N_CASTED]], align 4
441 // CHECK-NEXT: [[TMP18:%.*]] = load i64, ptr [[N_CASTED]], align 8
442 // CHECK-NEXT: [[TMP19:%.*]] = load ptr, ptr [[A_ADDR]], align 8
443 // CHECK-NEXT: [[TMP20:%.*]] = load ptr, ptr [[B_ADDR]], align 8
444 // CHECK-NEXT: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @[[GLOB2]], i32 5, ptr @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z18kernel_within_loopPiS_ii_l13.omp_outlined.omp_outlined, i64 [[TMP14]], i64 [[TMP16]], i64 [[TMP18]], ptr [[TMP19]], ptr [[TMP20]])
445 // CHECK-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
446 // CHECK: omp.inner.for.inc:
447 // CHECK-NEXT: [[TMP21:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
448 // CHECK-NEXT: [[TMP22:%.*]] = load i32, ptr [[DOTOMP_STRIDE]], align 4
449 // CHECK-NEXT: [[ADD6:%.*]] = add i32 [[TMP21]], [[TMP22]]
450 // CHECK-NEXT: store i32 [[ADD6]], ptr [[DOTOMP_IV]], align 4
451 // CHECK-NEXT: br label [[OMP_INNER_FOR_COND]]
452 // CHECK: omp.inner.for.end:
453 // CHECK-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
454 // CHECK: omp.loop.exit:
455 // CHECK-NEXT: [[TMP23:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
456 // CHECK-NEXT: [[TMP24:%.*]] = load i32, ptr [[TMP23]], align 4
457 // CHECK-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB3]], i32 [[TMP24]])
458 // CHECK-NEXT: br label [[OMP_PRECOND_END]]
459 // CHECK: omp.precond.end:
460 // CHECK-NEXT: ret void
463 // CHECK-LABEL: define internal void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z18kernel_within_loopPiS_ii_l13.omp_outlined.omp_outlined
464 // CHECK-SAME: (ptr noalias noundef [[DOTGLOBAL_TID_:%.*]], ptr noalias noundef [[DOTBOUND_TID_:%.*]], i64 noundef [[DOTPREVIOUS_LB_:%.*]], i64 noundef [[DOTPREVIOUS_UB_:%.*]], i64 noundef [[N:%.*]], ptr noundef [[A:%.*]], ptr noundef [[B:%.*]]) #[[ATTR1]] {
465 // CHECK-NEXT: entry:
466 // CHECK-NEXT: [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
467 // CHECK-NEXT: [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
468 // CHECK-NEXT: [[DOTPREVIOUS_LB__ADDR:%.*]] = alloca i64, align 8
469 // CHECK-NEXT: [[DOTPREVIOUS_UB__ADDR:%.*]] = alloca i64, align 8
470 // CHECK-NEXT: [[N_ADDR:%.*]] = alloca i64, align 8
471 // CHECK-NEXT: [[A_ADDR:%.*]] = alloca ptr, align 8
472 // CHECK-NEXT: [[B_ADDR:%.*]] = alloca ptr, align 8
473 // CHECK-NEXT: [[DOTOMP_IV:%.*]] = alloca i32, align 4
474 // CHECK-NEXT: [[TMP:%.*]] = alloca i32, align 4
475 // CHECK-NEXT: [[DOTCAPTURE_EXPR_:%.*]] = alloca i32, align 4
476 // CHECK-NEXT: [[DOTCAPTURE_EXPR_1:%.*]] = alloca i32, align 4
477 // CHECK-NEXT: [[J:%.*]] = alloca i32, align 4
478 // CHECK-NEXT: [[DOTOMP_LB:%.*]] = alloca i32, align 4
479 // CHECK-NEXT: [[DOTOMP_UB:%.*]] = alloca i32, align 4
480 // CHECK-NEXT: [[DOTOMP_STRIDE:%.*]] = alloca i32, align 4
481 // CHECK-NEXT: [[DOTOMP_IS_LAST:%.*]] = alloca i32, align 4
482 // CHECK-NEXT: [[J4:%.*]] = alloca i32, align 4
483 // CHECK-NEXT: store ptr [[DOTGLOBAL_TID_]], ptr [[DOTGLOBAL_TID__ADDR]], align 8
484 // CHECK-NEXT: store ptr [[DOTBOUND_TID_]], ptr [[DOTBOUND_TID__ADDR]], align 8
485 // CHECK-NEXT: store i64 [[DOTPREVIOUS_LB_]], ptr [[DOTPREVIOUS_LB__ADDR]], align 8
486 // CHECK-NEXT: store i64 [[DOTPREVIOUS_UB_]], ptr [[DOTPREVIOUS_UB__ADDR]], align 8
487 // CHECK-NEXT: store i64 [[N]], ptr [[N_ADDR]], align 8
488 // CHECK-NEXT: store ptr [[A]], ptr [[A_ADDR]], align 8
489 // CHECK-NEXT: store ptr [[B]], ptr [[B_ADDR]], align 8
490 // CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[N_ADDR]], align 4
491 // CHECK-NEXT: store i32 [[TMP0]], ptr [[DOTCAPTURE_EXPR_]], align 4
492 // CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
493 // CHECK-NEXT: [[SUB:%.*]] = sub i32 [[TMP1]], -2
494 // CHECK-NEXT: [[DIV:%.*]] = udiv i32 [[SUB]], 3
495 // CHECK-NEXT: [[SUB2:%.*]] = sub i32 [[DIV]], 1
496 // CHECK-NEXT: store i32 [[SUB2]], ptr [[DOTCAPTURE_EXPR_1]], align 4
497 // CHECK-NEXT: store i32 0, ptr [[J]], align 4
498 // CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_]], align 4
499 // CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 0, [[TMP2]]
500 // CHECK-NEXT: br i1 [[CMP]], label [[OMP_PRECOND_THEN:%.*]], label [[OMP_PRECOND_END:%.*]]
501 // CHECK: omp.precond.then:
502 // CHECK-NEXT: store i32 0, ptr [[DOTOMP_LB]], align 4
503 // CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
504 // CHECK-NEXT: store i32 [[TMP3]], ptr [[DOTOMP_UB]], align 4
505 // CHECK-NEXT: [[TMP4:%.*]] = load i64, ptr [[DOTPREVIOUS_LB__ADDR]], align 8
506 // CHECK-NEXT: [[CONV:%.*]] = trunc i64 [[TMP4]] to i32
507 // CHECK-NEXT: [[TMP5:%.*]] = load i64, ptr [[DOTPREVIOUS_UB__ADDR]], align 8
508 // CHECK-NEXT: [[CONV3:%.*]] = trunc i64 [[TMP5]] to i32
509 // CHECK-NEXT: store i32 [[CONV]], ptr [[DOTOMP_LB]], align 4
510 // CHECK-NEXT: store i32 [[CONV3]], ptr [[DOTOMP_UB]], align 4
511 // CHECK-NEXT: store i32 1, ptr [[DOTOMP_STRIDE]], align 4
512 // CHECK-NEXT: store i32 0, ptr [[DOTOMP_IS_LAST]], align 4
513 // CHECK-NEXT: [[TMP6:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
514 // CHECK-NEXT: [[TMP7:%.*]] = load i32, ptr [[TMP6]], align 4
515 // CHECK-NEXT: call void @__kmpc_for_static_init_4u(ptr @[[GLOB1]], i32 [[TMP7]], i32 34, ptr [[DOTOMP_IS_LAST]], ptr [[DOTOMP_LB]], ptr [[DOTOMP_UB]], ptr [[DOTOMP_STRIDE]], i32 1, i32 1)
516 // CHECK-NEXT: [[TMP8:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
517 // CHECK-NEXT: [[TMP9:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
518 // CHECK-NEXT: [[CMP5:%.*]] = icmp ugt i32 [[TMP8]], [[TMP9]]
519 // CHECK-NEXT: br i1 [[CMP5]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
521 // CHECK-NEXT: [[TMP10:%.*]] = load i32, ptr [[DOTCAPTURE_EXPR_1]], align 4
522 // CHECK-NEXT: br label [[COND_END:%.*]]
523 // CHECK: cond.false:
524 // CHECK-NEXT: [[TMP11:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
525 // CHECK-NEXT: br label [[COND_END]]
527 // CHECK-NEXT: [[COND:%.*]] = phi i32 [ [[TMP10]], [[COND_TRUE]] ], [ [[TMP11]], [[COND_FALSE]] ]
528 // CHECK-NEXT: store i32 [[COND]], ptr [[DOTOMP_UB]], align 4
529 // CHECK-NEXT: [[TMP12:%.*]] = load i32, ptr [[DOTOMP_LB]], align 4
530 // CHECK-NEXT: store i32 [[TMP12]], ptr [[DOTOMP_IV]], align 4
531 // CHECK-NEXT: br label [[OMP_INNER_FOR_COND:%.*]]
532 // CHECK: omp.inner.for.cond:
533 // CHECK-NEXT: [[TMP13:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
534 // CHECK-NEXT: [[TMP14:%.*]] = load i32, ptr [[DOTOMP_UB]], align 4
535 // CHECK-NEXT: [[ADD:%.*]] = add i32 [[TMP14]], 1
536 // CHECK-NEXT: [[CMP6:%.*]] = icmp ult i32 [[TMP13]], [[ADD]]
537 // CHECK-NEXT: br i1 [[CMP6]], label [[OMP_INNER_FOR_BODY:%.*]], label [[OMP_INNER_FOR_END:%.*]]
538 // CHECK: omp.inner.for.body:
539 // CHECK-NEXT: [[TMP15:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
540 // CHECK-NEXT: [[MUL:%.*]] = mul i32 [[TMP15]], 3
541 // CHECK-NEXT: [[ADD7:%.*]] = add i32 0, [[MUL]]
542 // CHECK-NEXT: store i32 [[ADD7]], ptr [[J4]], align 4
543 // CHECK-NEXT: [[TMP16:%.*]] = load ptr, ptr [[B_ADDR]], align 8
544 // CHECK-NEXT: [[TMP17:%.*]] = load i32, ptr [[J4]], align 4
545 // CHECK-NEXT: [[IDXPROM:%.*]] = sext i32 [[TMP17]] to i64
546 // CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[TMP16]], i64 [[IDXPROM]]
547 // CHECK-NEXT: [[TMP18:%.*]] = load i32, ptr [[ARRAYIDX]], align 4
548 // CHECK-NEXT: [[MUL8:%.*]] = mul nsw i32 [[TMP18]], 2
549 // CHECK-NEXT: [[TMP19:%.*]] = load ptr, ptr [[A_ADDR]], align 8
550 // CHECK-NEXT: [[TMP20:%.*]] = load i32, ptr [[J4]], align 4
551 // CHECK-NEXT: [[IDXPROM9:%.*]] = sext i32 [[TMP20]] to i64
552 // CHECK-NEXT: [[ARRAYIDX10:%.*]] = getelementptr inbounds i32, ptr [[TMP19]], i64 [[IDXPROM9]]
553 // CHECK-NEXT: store i32 [[MUL8]], ptr [[ARRAYIDX10]], align 4
554 // CHECK-NEXT: br label [[OMP_BODY_CONTINUE:%.*]]
555 // CHECK: omp.body.continue:
556 // CHECK-NEXT: br label [[OMP_INNER_FOR_INC:%.*]]
557 // CHECK: omp.inner.for.inc:
558 // CHECK-NEXT: [[TMP21:%.*]] = load i32, ptr [[DOTOMP_IV]], align 4
559 // CHECK-NEXT: [[ADD11:%.*]] = add i32 [[TMP21]], 1
560 // CHECK-NEXT: store i32 [[ADD11]], ptr [[DOTOMP_IV]], align 4
561 // CHECK-NEXT: br label [[OMP_INNER_FOR_COND]]
562 // CHECK: omp.inner.for.end:
563 // CHECK-NEXT: br label [[OMP_LOOP_EXIT:%.*]]
564 // CHECK: omp.loop.exit:
565 // CHECK-NEXT: [[TMP22:%.*]] = load ptr, ptr [[DOTGLOBAL_TID__ADDR]], align 8
566 // CHECK-NEXT: [[TMP23:%.*]] = load i32, ptr [[TMP22]], align 4
567 // CHECK-NEXT: call void @__kmpc_for_static_fini(ptr @[[GLOB1]], i32 [[TMP23]])
568 // CHECK-NEXT: br label [[OMP_PRECOND_END]]
569 // CHECK: omp.precond.end:
570 // CHECK-NEXT: ret void