Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / target_map_deref_array_codegen.cpp
blob11ff8125a0a9976faf1380f4755f4ad31202e955
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-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s
3 // RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
4 // RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
6 // expected-no-diagnostics
7 #ifndef HEADER
8 #define HEADER
10 extern void *malloc (int __size) throw () __attribute__ ((__malloc__));
12 void foo(int **t1d)
14 *t1d = (int *) malloc(3 * sizeof(int));
15 for (int j=0; j < 3; j++)
16 (*t1d)[j] = 1;
17 #pragma omp target map(to: (*t1d)[0:3])
18 (*t1d)[2] = 2;
19 #pragma omp target map(tofrom : (**t1d))
20 (*t1d)[0] = 3;
21 int a = 0, b = 0;
22 #pragma omp target map(tofrom : (*(*(t1d+a)+b)))
23 *(*(t1d+a)+b) = 4;
26 #endif
28 // CHECK-LABEL: define {{[^@]+}}@_Z3fooPPi
29 // CHECK-SAME: (ptr noundef [[T1D:%.*]]) #[[ATTR0:[0-9]+]] {
30 // CHECK-NEXT: entry:
31 // CHECK-NEXT: [[T1D_ADDR:%.*]] = alloca ptr, align 8
32 // CHECK-NEXT: [[J:%.*]] = alloca i32, align 4
33 // CHECK-NEXT: [[DOTOFFLOAD_BASEPTRS:%.*]] = alloca [2 x ptr], align 8
34 // CHECK-NEXT: [[DOTOFFLOAD_PTRS:%.*]] = alloca [2 x ptr], align 8
35 // CHECK-NEXT: [[DOTOFFLOAD_MAPPERS:%.*]] = alloca [2 x ptr], align 8
36 // CHECK-NEXT: [[KERNEL_ARGS:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS:%.*]], align 8
37 // CHECK-NEXT: [[DOTOFFLOAD_BASEPTRS2:%.*]] = alloca [2 x ptr], align 8
38 // CHECK-NEXT: [[DOTOFFLOAD_PTRS3:%.*]] = alloca [2 x ptr], align 8
39 // CHECK-NEXT: [[DOTOFFLOAD_MAPPERS4:%.*]] = alloca [2 x ptr], align 8
40 // CHECK-NEXT: [[KERNEL_ARGS5:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS]], align 8
41 // CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
42 // CHECK-NEXT: [[B:%.*]] = alloca i32, align 4
43 // CHECK-NEXT: [[A_CASTED:%.*]] = alloca i64, align 8
44 // CHECK-NEXT: [[B_CASTED:%.*]] = alloca i64, align 8
45 // CHECK-NEXT: [[DOTOFFLOAD_BASEPTRS12:%.*]] = alloca [4 x ptr], align 8
46 // CHECK-NEXT: [[DOTOFFLOAD_PTRS13:%.*]] = alloca [4 x ptr], align 8
47 // CHECK-NEXT: [[DOTOFFLOAD_MAPPERS14:%.*]] = alloca [4 x ptr], align 8
48 // CHECK-NEXT: [[KERNEL_ARGS15:%.*]] = alloca [[STRUCT___TGT_KERNEL_ARGUMENTS]], align 8
49 // CHECK-NEXT: store ptr [[T1D]], ptr [[T1D_ADDR]], align 8
50 // CHECK-NEXT: [[CALL:%.*]] = call noalias noundef ptr @_Z6malloci(i32 noundef signext 12) #[[ATTR3:[0-9]+]]
51 // CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[T1D_ADDR]], align 8
52 // CHECK-NEXT: store ptr [[CALL]], ptr [[TMP0]], align 8
53 // CHECK-NEXT: store i32 0, ptr [[J]], align 4
54 // CHECK-NEXT: br label [[FOR_COND:%.*]]
55 // CHECK: for.cond:
56 // CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[J]], align 4
57 // CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[TMP1]], 3
58 // CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
59 // CHECK: for.body:
60 // CHECK-NEXT: [[TMP2:%.*]] = load ptr, ptr [[T1D_ADDR]], align 8
61 // CHECK-NEXT: [[TMP3:%.*]] = load ptr, ptr [[TMP2]], align 8
62 // CHECK-NEXT: [[TMP4:%.*]] = load i32, ptr [[J]], align 4
63 // CHECK-NEXT: [[IDXPROM:%.*]] = sext i32 [[TMP4]] to i64
64 // CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[TMP3]], i64 [[IDXPROM]]
65 // CHECK-NEXT: store i32 1, ptr [[ARRAYIDX]], align 4
66 // CHECK-NEXT: br label [[FOR_INC:%.*]]
67 // CHECK: for.inc:
68 // CHECK-NEXT: [[TMP5:%.*]] = load i32, ptr [[J]], align 4
69 // CHECK-NEXT: [[INC:%.*]] = add nsw i32 [[TMP5]], 1
70 // CHECK-NEXT: store i32 [[INC]], ptr [[J]], align 4
71 // CHECK-NEXT: br label [[FOR_COND]], !llvm.loop [[LOOP6:![0-9]+]]
72 // CHECK: for.end:
73 // CHECK-NEXT: [[TMP6:%.*]] = load ptr, ptr [[T1D_ADDR]], align 8
74 // CHECK-NEXT: [[TMP7:%.*]] = load ptr, ptr [[T1D_ADDR]], align 8
75 // CHECK-NEXT: [[TMP8:%.*]] = load ptr, ptr [[T1D_ADDR]], align 8
76 // CHECK-NEXT: [[TMP9:%.*]] = load ptr, ptr [[T1D_ADDR]], align 8
77 // CHECK-NEXT: [[TMP10:%.*]] = load ptr, ptr [[TMP9]], align 8
78 // CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds i32, ptr [[TMP10]], i64 0
79 // CHECK-NEXT: [[TMP11:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
80 // CHECK-NEXT: store ptr [[TMP7]], ptr [[TMP11]], align 8
81 // CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
82 // CHECK-NEXT: store ptr [[TMP8]], ptr [[TMP12]], align 8
83 // CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 0
84 // CHECK-NEXT: store ptr null, ptr [[TMP13]], align 8
85 // CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 1
86 // CHECK-NEXT: store ptr [[TMP8]], ptr [[TMP14]], align 8
87 // CHECK-NEXT: [[TMP15:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 1
88 // CHECK-NEXT: store ptr [[ARRAYIDX1]], ptr [[TMP15]], align 8
89 // CHECK-NEXT: [[TMP16:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_MAPPERS]], i64 0, i64 1
90 // CHECK-NEXT: store ptr null, ptr [[TMP16]], align 8
91 // CHECK-NEXT: [[TMP17:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_BASEPTRS]], i32 0, i32 0
92 // CHECK-NEXT: [[TMP18:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_PTRS]], i32 0, i32 0
93 // CHECK-NEXT: [[TMP19:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 0
94 // CHECK-NEXT: store i32 2, ptr [[TMP19]], align 4
95 // CHECK-NEXT: [[TMP20:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 1
96 // CHECK-NEXT: store i32 2, ptr [[TMP20]], align 4
97 // CHECK-NEXT: [[TMP21:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 2
98 // CHECK-NEXT: store ptr [[TMP17]], ptr [[TMP21]], align 8
99 // CHECK-NEXT: [[TMP22:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 3
100 // CHECK-NEXT: store ptr [[TMP18]], ptr [[TMP22]], align 8
101 // CHECK-NEXT: [[TMP23:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 4
102 // CHECK-NEXT: store ptr @.offload_sizes, ptr [[TMP23]], align 8
103 // CHECK-NEXT: [[TMP24:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 5
104 // CHECK-NEXT: store ptr @.offload_maptypes, ptr [[TMP24]], align 8
105 // CHECK-NEXT: [[TMP25:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 6
106 // CHECK-NEXT: store ptr null, ptr [[TMP25]], align 8
107 // CHECK-NEXT: [[TMP26:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 7
108 // CHECK-NEXT: store ptr null, ptr [[TMP26]], align 8
109 // CHECK-NEXT: [[TMP27:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 8
110 // CHECK-NEXT: store i64 0, ptr [[TMP27]], align 8
111 // CHECK-NEXT: [[TMP28:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 9
112 // CHECK-NEXT: store i64 0, ptr [[TMP28]], align 8
113 // CHECK-NEXT: [[TMP29:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 10
114 // CHECK-NEXT: store [3 x i32] [i32 -1, i32 0, i32 0], ptr [[TMP29]], align 4
115 // CHECK-NEXT: [[TMP30:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 11
116 // CHECK-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP30]], align 4
117 // CHECK-NEXT: [[TMP31:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS]], i32 0, i32 12
118 // CHECK-NEXT: store i32 0, ptr [[TMP31]], align 4
119 // CHECK-NEXT: [[TMP32:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB1:[0-9]+]], i64 -1, i32 -1, i32 0, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z3fooPPi_l17.region_id, ptr [[KERNEL_ARGS]])
120 // CHECK-NEXT: [[TMP33:%.*]] = icmp ne i32 [[TMP32]], 0
121 // CHECK-NEXT: br i1 [[TMP33]], label [[OMP_OFFLOAD_FAILED:%.*]], label [[OMP_OFFLOAD_CONT:%.*]]
122 // CHECK: omp_offload.failed:
123 // CHECK-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z3fooPPi_l17(ptr [[TMP6]]) #[[ATTR3]]
124 // CHECK-NEXT: br label [[OMP_OFFLOAD_CONT]]
125 // CHECK: omp_offload.cont:
126 // CHECK-NEXT: [[TMP34:%.*]] = load ptr, ptr [[T1D_ADDR]], align 8
127 // CHECK-NEXT: [[TMP35:%.*]] = load ptr, ptr [[T1D_ADDR]], align 8
128 // CHECK-NEXT: [[TMP36:%.*]] = load ptr, ptr [[T1D_ADDR]], align 8
129 // CHECK-NEXT: [[TMP37:%.*]] = load ptr, ptr [[T1D_ADDR]], align 8
130 // CHECK-NEXT: [[TMP38:%.*]] = load ptr, ptr [[TMP37]], align 8
131 // CHECK-NEXT: [[TMP39:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_BASEPTRS2]], i32 0, i32 0
132 // CHECK-NEXT: store ptr [[TMP35]], ptr [[TMP39]], align 8
133 // CHECK-NEXT: [[TMP40:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_PTRS3]], i32 0, i32 0
134 // CHECK-NEXT: store ptr [[TMP36]], ptr [[TMP40]], align 8
135 // CHECK-NEXT: [[TMP41:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_MAPPERS4]], i64 0, i64 0
136 // CHECK-NEXT: store ptr null, ptr [[TMP41]], align 8
137 // CHECK-NEXT: [[TMP42:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_BASEPTRS2]], i32 0, i32 1
138 // CHECK-NEXT: store ptr [[TMP36]], ptr [[TMP42]], align 8
139 // CHECK-NEXT: [[TMP43:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_PTRS3]], i32 0, i32 1
140 // CHECK-NEXT: store ptr [[TMP38]], ptr [[TMP43]], align 8
141 // CHECK-NEXT: [[TMP44:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_MAPPERS4]], i64 0, i64 1
142 // CHECK-NEXT: store ptr null, ptr [[TMP44]], align 8
143 // CHECK-NEXT: [[TMP45:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_BASEPTRS2]], i32 0, i32 0
144 // CHECK-NEXT: [[TMP46:%.*]] = getelementptr inbounds [2 x ptr], ptr [[DOTOFFLOAD_PTRS3]], i32 0, i32 0
145 // CHECK-NEXT: [[TMP47:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS5]], i32 0, i32 0
146 // CHECK-NEXT: store i32 2, ptr [[TMP47]], align 4
147 // CHECK-NEXT: [[TMP48:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS5]], i32 0, i32 1
148 // CHECK-NEXT: store i32 2, ptr [[TMP48]], align 4
149 // CHECK-NEXT: [[TMP49:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS5]], i32 0, i32 2
150 // CHECK-NEXT: store ptr [[TMP45]], ptr [[TMP49]], align 8
151 // CHECK-NEXT: [[TMP50:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS5]], i32 0, i32 3
152 // CHECK-NEXT: store ptr [[TMP46]], ptr [[TMP50]], align 8
153 // CHECK-NEXT: [[TMP51:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS5]], i32 0, i32 4
154 // CHECK-NEXT: store ptr @.offload_sizes.1, ptr [[TMP51]], align 8
155 // CHECK-NEXT: [[TMP52:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS5]], i32 0, i32 5
156 // CHECK-NEXT: store ptr @.offload_maptypes.2, ptr [[TMP52]], align 8
157 // CHECK-NEXT: [[TMP53:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS5]], i32 0, i32 6
158 // CHECK-NEXT: store ptr null, ptr [[TMP53]], align 8
159 // CHECK-NEXT: [[TMP54:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS5]], i32 0, i32 7
160 // CHECK-NEXT: store ptr null, ptr [[TMP54]], align 8
161 // CHECK-NEXT: [[TMP55:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS5]], i32 0, i32 8
162 // CHECK-NEXT: store i64 0, ptr [[TMP55]], align 8
163 // CHECK-NEXT: [[TMP56:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS5]], i32 0, i32 9
164 // CHECK-NEXT: store i64 0, ptr [[TMP56]], align 8
165 // CHECK-NEXT: [[TMP57:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS5]], i32 0, i32 10
166 // CHECK-NEXT: store [3 x i32] [i32 -1, i32 0, i32 0], ptr [[TMP57]], align 4
167 // CHECK-NEXT: [[TMP58:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS5]], i32 0, i32 11
168 // CHECK-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP58]], align 4
169 // CHECK-NEXT: [[TMP59:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS5]], i32 0, i32 12
170 // CHECK-NEXT: store i32 0, ptr [[TMP59]], align 4
171 // CHECK-NEXT: [[TMP60:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB1]], i64 -1, i32 -1, i32 0, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z3fooPPi_l19.region_id, ptr [[KERNEL_ARGS5]])
172 // CHECK-NEXT: [[TMP61:%.*]] = icmp ne i32 [[TMP60]], 0
173 // CHECK-NEXT: br i1 [[TMP61]], label [[OMP_OFFLOAD_FAILED6:%.*]], label [[OMP_OFFLOAD_CONT7:%.*]]
174 // CHECK: omp_offload.failed6:
175 // CHECK-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z3fooPPi_l19(ptr [[TMP34]]) #[[ATTR3]]
176 // CHECK-NEXT: br label [[OMP_OFFLOAD_CONT7]]
177 // CHECK: omp_offload.cont7:
178 // CHECK-NEXT: store i32 0, ptr [[A]], align 4
179 // CHECK-NEXT: store i32 0, ptr [[B]], align 4
180 // CHECK-NEXT: [[TMP62:%.*]] = load ptr, ptr [[T1D_ADDR]], align 8
181 // CHECK-NEXT: [[TMP63:%.*]] = load i32, ptr [[A]], align 4
182 // CHECK-NEXT: store i32 [[TMP63]], ptr [[A_CASTED]], align 4
183 // CHECK-NEXT: [[TMP64:%.*]] = load i64, ptr [[A_CASTED]], align 8
184 // CHECK-NEXT: [[TMP65:%.*]] = load i32, ptr [[B]], align 4
185 // CHECK-NEXT: store i32 [[TMP65]], ptr [[B_CASTED]], align 4
186 // CHECK-NEXT: [[TMP66:%.*]] = load i64, ptr [[B_CASTED]], align 8
187 // CHECK-NEXT: [[TMP67:%.*]] = load ptr, ptr [[T1D_ADDR]], align 8
188 // CHECK-NEXT: [[TMP68:%.*]] = load ptr, ptr [[T1D_ADDR]], align 8
189 // CHECK-NEXT: [[TMP69:%.*]] = load i32, ptr [[A]], align 4
190 // CHECK-NEXT: [[IDX_EXT:%.*]] = sext i32 [[TMP69]] to i64
191 // CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds ptr, ptr [[TMP68]], i64 [[IDX_EXT]]
192 // CHECK-NEXT: [[TMP70:%.*]] = load ptr, ptr [[T1D_ADDR]], align 8
193 // CHECK-NEXT: [[TMP71:%.*]] = load i32, ptr [[A]], align 4
194 // CHECK-NEXT: [[IDX_EXT8:%.*]] = sext i32 [[TMP71]] to i64
195 // CHECK-NEXT: [[ADD_PTR9:%.*]] = getelementptr inbounds ptr, ptr [[TMP70]], i64 [[IDX_EXT8]]
196 // CHECK-NEXT: [[TMP72:%.*]] = load ptr, ptr [[ADD_PTR9]], align 8
197 // CHECK-NEXT: [[TMP73:%.*]] = load i32, ptr [[B]], align 4
198 // CHECK-NEXT: [[IDX_EXT10:%.*]] = sext i32 [[TMP73]] to i64
199 // CHECK-NEXT: [[ADD_PTR11:%.*]] = getelementptr inbounds i32, ptr [[TMP72]], i64 [[IDX_EXT10]]
200 // CHECK-NEXT: [[TMP74:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_BASEPTRS12]], i32 0, i32 0
201 // CHECK-NEXT: store ptr [[TMP67]], ptr [[TMP74]], align 8
202 // CHECK-NEXT: [[TMP75:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_PTRS13]], i32 0, i32 0
203 // CHECK-NEXT: store ptr [[ADD_PTR]], ptr [[TMP75]], align 8
204 // CHECK-NEXT: [[TMP76:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_MAPPERS14]], i64 0, i64 0
205 // CHECK-NEXT: store ptr null, ptr [[TMP76]], align 8
206 // CHECK-NEXT: [[TMP77:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_BASEPTRS12]], i32 0, i32 1
207 // CHECK-NEXT: store ptr [[ADD_PTR]], ptr [[TMP77]], align 8
208 // CHECK-NEXT: [[TMP78:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_PTRS13]], i32 0, i32 1
209 // CHECK-NEXT: store ptr [[ADD_PTR11]], ptr [[TMP78]], align 8
210 // CHECK-NEXT: [[TMP79:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_MAPPERS14]], i64 0, i64 1
211 // CHECK-NEXT: store ptr null, ptr [[TMP79]], align 8
212 // CHECK-NEXT: [[TMP80:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_BASEPTRS12]], i32 0, i32 2
213 // CHECK-NEXT: store i64 [[TMP64]], ptr [[TMP80]], align 8
214 // CHECK-NEXT: [[TMP81:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_PTRS13]], i32 0, i32 2
215 // CHECK-NEXT: store i64 [[TMP64]], ptr [[TMP81]], align 8
216 // CHECK-NEXT: [[TMP82:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_MAPPERS14]], i64 0, i64 2
217 // CHECK-NEXT: store ptr null, ptr [[TMP82]], align 8
218 // CHECK-NEXT: [[TMP83:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_BASEPTRS12]], i32 0, i32 3
219 // CHECK-NEXT: store i64 [[TMP66]], ptr [[TMP83]], align 8
220 // CHECK-NEXT: [[TMP84:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_PTRS13]], i32 0, i32 3
221 // CHECK-NEXT: store i64 [[TMP66]], ptr [[TMP84]], align 8
222 // CHECK-NEXT: [[TMP85:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_MAPPERS14]], i64 0, i64 3
223 // CHECK-NEXT: store ptr null, ptr [[TMP85]], align 8
224 // CHECK-NEXT: [[TMP86:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_BASEPTRS12]], i32 0, i32 0
225 // CHECK-NEXT: [[TMP87:%.*]] = getelementptr inbounds [4 x ptr], ptr [[DOTOFFLOAD_PTRS13]], i32 0, i32 0
226 // CHECK-NEXT: [[TMP88:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 0
227 // CHECK-NEXT: store i32 2, ptr [[TMP88]], align 4
228 // CHECK-NEXT: [[TMP89:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 1
229 // CHECK-NEXT: store i32 4, ptr [[TMP89]], align 4
230 // CHECK-NEXT: [[TMP90:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 2
231 // CHECK-NEXT: store ptr [[TMP86]], ptr [[TMP90]], align 8
232 // CHECK-NEXT: [[TMP91:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 3
233 // CHECK-NEXT: store ptr [[TMP87]], ptr [[TMP91]], align 8
234 // CHECK-NEXT: [[TMP92:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 4
235 // CHECK-NEXT: store ptr @.offload_sizes.3, ptr [[TMP92]], align 8
236 // CHECK-NEXT: [[TMP93:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 5
237 // CHECK-NEXT: store ptr @.offload_maptypes.4, ptr [[TMP93]], align 8
238 // CHECK-NEXT: [[TMP94:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 6
239 // CHECK-NEXT: store ptr null, ptr [[TMP94]], align 8
240 // CHECK-NEXT: [[TMP95:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 7
241 // CHECK-NEXT: store ptr null, ptr [[TMP95]], align 8
242 // CHECK-NEXT: [[TMP96:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 8
243 // CHECK-NEXT: store i64 0, ptr [[TMP96]], align 8
244 // CHECK-NEXT: [[TMP97:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 9
245 // CHECK-NEXT: store i64 0, ptr [[TMP97]], align 8
246 // CHECK-NEXT: [[TMP98:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 10
247 // CHECK-NEXT: store [3 x i32] [i32 -1, i32 0, i32 0], ptr [[TMP98]], align 4
248 // CHECK-NEXT: [[TMP99:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 11
249 // CHECK-NEXT: store [3 x i32] zeroinitializer, ptr [[TMP99]], align 4
250 // CHECK-NEXT: [[TMP100:%.*]] = getelementptr inbounds [[STRUCT___TGT_KERNEL_ARGUMENTS]], ptr [[KERNEL_ARGS15]], i32 0, i32 12
251 // CHECK-NEXT: store i32 0, ptr [[TMP100]], align 4
252 // CHECK-NEXT: [[TMP101:%.*]] = call i32 @__tgt_target_kernel(ptr @[[GLOB1]], i64 -1, i32 -1, i32 0, ptr @.{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z3fooPPi_l22.region_id, ptr [[KERNEL_ARGS15]])
253 // CHECK-NEXT: [[TMP102:%.*]] = icmp ne i32 [[TMP101]], 0
254 // CHECK-NEXT: br i1 [[TMP102]], label [[OMP_OFFLOAD_FAILED16:%.*]], label [[OMP_OFFLOAD_CONT17:%.*]]
255 // CHECK: omp_offload.failed16:
256 // CHECK-NEXT: call void @{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z3fooPPi_l22(ptr [[TMP62]], i64 [[TMP64]], i64 [[TMP66]]) #[[ATTR3]]
257 // CHECK-NEXT: br label [[OMP_OFFLOAD_CONT17]]
258 // CHECK: omp_offload.cont17:
259 // CHECK-NEXT: ret void
262 // CHECK-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z3fooPPi_l17
263 // CHECK-SAME: (ptr noundef [[T1D:%.*]]) #[[ATTR2:[0-9]+]] {
264 // CHECK-NEXT: entry:
265 // CHECK-NEXT: [[T1D_ADDR:%.*]] = alloca ptr, align 8
266 // CHECK-NEXT: store ptr [[T1D]], ptr [[T1D_ADDR]], align 8
267 // CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[T1D_ADDR]], align 8
268 // CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr [[TMP0]], align 8
269 // CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[TMP1]], i64 2
270 // CHECK-NEXT: store i32 2, ptr [[ARRAYIDX]], align 4
271 // CHECK-NEXT: ret void
274 // CHECK-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z3fooPPi_l19
275 // CHECK-SAME: (ptr noundef [[T1D:%.*]]) #[[ATTR2]] {
276 // CHECK-NEXT: entry:
277 // CHECK-NEXT: [[T1D_ADDR:%.*]] = alloca ptr, align 8
278 // CHECK-NEXT: store ptr [[T1D]], ptr [[T1D_ADDR]], align 8
279 // CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[T1D_ADDR]], align 8
280 // CHECK-NEXT: [[TMP1:%.*]] = load ptr, ptr [[TMP0]], align 8
281 // CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds i32, ptr [[TMP1]], i64 0
282 // CHECK-NEXT: store i32 3, ptr [[ARRAYIDX]], align 4
283 // CHECK-NEXT: ret void
286 // CHECK-LABEL: define {{[^@]+}}@{{__omp_offloading_[0-9a-z]+_[0-9a-z]+}}__Z3fooPPi_l22
287 // CHECK-SAME: (ptr noundef [[T1D:%.*]], i64 noundef [[A:%.*]], i64 noundef [[B:%.*]]) #[[ATTR2]] {
288 // CHECK-NEXT: entry:
289 // CHECK-NEXT: [[T1D_ADDR:%.*]] = alloca ptr, align 8
290 // CHECK-NEXT: [[A_ADDR:%.*]] = alloca i64, align 8
291 // CHECK-NEXT: [[B_ADDR:%.*]] = alloca i64, align 8
292 // CHECK-NEXT: store ptr [[T1D]], ptr [[T1D_ADDR]], align 8
293 // CHECK-NEXT: store i64 [[A]], ptr [[A_ADDR]], align 8
294 // CHECK-NEXT: store i64 [[B]], ptr [[B_ADDR]], align 8
295 // CHECK-NEXT: [[TMP0:%.*]] = load ptr, ptr [[T1D_ADDR]], align 8
296 // CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[A_ADDR]], align 4
297 // CHECK-NEXT: [[IDX_EXT:%.*]] = sext i32 [[TMP1]] to i64
298 // CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds ptr, ptr [[TMP0]], i64 [[IDX_EXT]]
299 // CHECK-NEXT: [[TMP2:%.*]] = load ptr, ptr [[ADD_PTR]], align 8
300 // CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[B_ADDR]], align 4
301 // CHECK-NEXT: [[IDX_EXT1:%.*]] = sext i32 [[TMP3]] to i64
302 // CHECK-NEXT: [[ADD_PTR2:%.*]] = getelementptr inbounds i32, ptr [[TMP2]], i64 [[IDX_EXT1]]
303 // CHECK-NEXT: store i32 4, ptr [[ADD_PTR2]], align 4
304 // CHECK-NEXT: ret void
307 // CHECK-LABEL: define {{[^@]+}}@.omp_offloading.requires_reg
308 // CHECK-SAME: () #[[ATTR4:[0-9]+]] {
309 // CHECK-NEXT: entry:
310 // CHECK-NEXT: call void @__tgt_register_requires(i64 1)
311 // CHECK-NEXT: ret void