Debian Codegraph @

IGC/ocloc_tests/SPIRV-extenstions/SPV_INTEL_fpga_loop_controls/FPGAIVDepLoopAttr.ll

raw
1 ; This LLVM IR was generated using Intel SYCL Clang compiler (https://github.com/intel/llvm)
2 ;
3 ; SYCL source code of this program can be found below.
4 ;
5 ; void ivdep_embedded_multiple_dimensions() {
6 ; int a[10];
7 ; int b[10];
8 ; [[intelfpga::ivdep]]
9 ; for (int i = 0; i != 10; ++i) {
10 ; a[i] = i;
11 ; b[i] = i;
12 ; [[intelfpga::ivdep]]
13 ; for (int j = 0; j != 10; ++j) {
14 ; a[j] += j;
15 ; b[j] += j;
16 ; [[intelfpga::ivdep]]
17 ; for (int k = 0; k != 10; ++k) {
18 ; a[k] += k;
19 ; b[k] += k;
20 ; }
21 ; }
22 ; }
23 ; }
24 ;
25 ; void ivdep_mul_arrays_and_global() {
26 ; int a[10];
27 ; int b[10];
28 ; int c[10];
29 ; int d[10];
30 ; [[intelfpga::ivdep(5)]]
31 ; [[intelfpga::ivdep(b, 6)]]
32 ; [[intelfpga::ivdep(c)]]
33 ; for (int i = 0; i != 10; ++i) {
34 ; a[i] = 0;
35 ; b[i] = 0;
36 ; c[i] = 0;
37 ; d[i] = 0;
38 ; }
39 ; }
40 ;
41 ; void ivdep_embedded_inner_access() {
42 ; int a[10][10][10];
43 ; int b[10][10][10];
44 ; [[intelfpga::ivdep]]
45 ; for (int i = 0; i != 10; ++i) {
46 ; [[intelfpga::ivdep]]
47 ; for (int j = 0; j != 10; ++j) {
48 ; [[intelfpga::ivdep]]
49 ; for (int k = 0; k != 10; ++k) {
50 ; a[i][j][k] = b[i][j][k];
51 ; }
52 ; }
53 ; }
54 ; }
55 ;
56 ; template <typename name, typename Func>
57 ; __attribute__((sycl_kernel)) void kernel_single_task(Func kernelFunc) {
58 ; kernelFunc();
59 ; }
60 ;
61 ; int main() {
62 ; kernel_single_task<class kernel_function>([]() {
63 ; ivdep_embedded_multiple_dimensions();
64 ; ivdep_mul_arrays_and_global();
65 ; ivdep_embedded_inner_access();
66 ; });
67 ; return 0;
68 ; }
69
70 ; UNSUPPORTED: system-windows
71 ; REQUIRES: llvm-spirv, regkeys, dg2-supported
72
73 ; RUN: llvm-as %s -o %t.bc
74 ; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_INTEL_fpga_loop_controls -o %t.spv
75
76 ; CHECK-LLVM is the base prefix, which includes simple checks for
77 ; "llvm.loop.parallel_access_indices" MD nodes with only 1 index group operand
78 ; CHECK-LLVM-MD-OP-<N> is the group of prefixes to check for more
79 ; complicated cases of "llvm.loop.parallel_access_indices" nodes, the ones
80 ; containing multiple index group operands that could come in indeterminate order
81 ; RUN: ocloc compile -spirv_input -file %t.spv -device dg2 -options " -igc_opts 'ShaderDumpTranslationOnly=1'" 2>&1 | FileCheck %s --check-prefixes=CHECK-LLVM,CHECK-LLVM-MD-OP1
82 ; RUN: ocloc compile -spirv_input -file %t.spv -device dg2 -options " -igc_opts 'ShaderDumpTranslationOnly=1'" 2>&1 | FileCheck %s --check-prefixes=CHECK-LLVM,CHECK-LLVM-MD-OP2
83
84 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
85 target triple = "spir64-unknown-unknown"
86
87 %"class._ZTSZ4mainE3$_0.anon" = type { i8 }
88
89 define dso_local spir_kernel void @_ZTSZ4mainE15kernel_function() #0 !kernel_arg_addr_space !4 !kernel_arg_access_qual !4 !kernel_arg_type !4 !kernel_arg_base_type !4 !kernel_arg_type_qual !4 {
90 %1 = alloca %"class._ZTSZ4mainE3$_0.anon", align 1
91 %2 = bitcast %"class._ZTSZ4mainE3$_0.anon"* %1 to i8*
92 call void @llvm.lifetime.start.p0i8(i64 1, i8* %2) #4
93 %3 = addrspacecast %"class._ZTSZ4mainE3$_0.anon"* %1 to %"class._ZTSZ4mainE3$_0.anon" addrspace(4)*
94 call spir_func void @"_ZZ4mainENK3$_0clEv"(%"class._ZTSZ4mainE3$_0.anon" addrspace(4)* %3)
95 %4 = bitcast %"class._ZTSZ4mainE3$_0.anon"* %1 to i8*
96 call void @llvm.lifetime.end.p0i8(i64 1, i8* %4) #4
97 ret void
98 }
99
100 ; Function Attrs: argmemonly nounwind willreturn
101 declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #1
102
103 ; Function Attrs: inlinehint nounwind
104 define internal spir_func void @"_ZZ4mainENK3$_0clEv"(%"class._ZTSZ4mainE3$_0.anon" addrspace(4)* %0) #2 align 2 {
105 %2 = alloca %"class._ZTSZ4mainE3$_0.anon" addrspace(4)*, align 8
106 store %"class._ZTSZ4mainE3$_0.anon" addrspace(4)* %0, %"class._ZTSZ4mainE3$_0.anon" addrspace(4)** %2, align 8, !tbaa !5
107 call spir_func void @_Z34ivdep_embedded_multiple_dimensionsv()
108 call spir_func void @_Z27ivdep_mul_arrays_and_globalv()
109 call spir_func void @_Z27ivdep_embedded_inner_accessv()
110 ret void
111 }
112
113 ; Function Attrs: argmemonly nounwind willreturn
114 declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #1
115
116 ; Function Attrs: nounwind
117 define dso_local spir_func void @_Z34ivdep_embedded_multiple_dimensionsv() #3 {
118 ; CHECK-LLVM: %[[EMB_ARRAY_A:[0-9]+]] = alloca [10 x i32]
119 %1 = alloca [10 x i32], align 4
120 ; CHECK-LLVM: %[[EMB_ARRAY_B:[0-9]+]] = alloca [10 x i32]
121 %2 = alloca [10 x i32], align 4
122 %3 = alloca i32, align 4
123 %4 = alloca i32, align 4
124 %5 = alloca i32, align 4
125 %6 = alloca i32, align 4
126 %7 = bitcast [10 x i32]* %1 to i8*
127 call void @llvm.lifetime.start.p0i8(i64 40, i8* %7) #4
128 %8 = bitcast [10 x i32]* %2 to i8*
129 call void @llvm.lifetime.start.p0i8(i64 40, i8* %8) #4
130 %9 = bitcast i32* %3 to i8*
131 call void @llvm.lifetime.start.p0i8(i64 4, i8* %9) #4
132 store i32 0, i32* %3, align 4, !tbaa !9
133 br label %10
134
135 10: ; preds = %70, %0
136 %11 = load i32, i32* %3, align 4, !tbaa !9
137 %12 = icmp ne i32 %11, 10
138 br i1 %12, label %15, label %13
139
140 13: ; preds = %10
141 store i32 2, i32* %4, align 4
142 %14 = bitcast i32* %3 to i8*
143 call void @llvm.lifetime.end.p0i8(i64 4, i8* %14) #4
144 br label %73
145
146 15: ; preds = %10
147 %16 = load i32, i32* %3, align 4, !tbaa !9
148 %17 = load i32, i32* %3, align 4, !tbaa !9
149 %18 = sext i32 %17 to i64
150 ; CHECK-LLVM: getelementptr inbounds [10 x i32], [10 x i32]* %[[EMB_ARRAY_A]], {{.*}}, !llvm.index.group ![[EMB_A_IDX_GR_DIM_1:[0-9]+]]
151 %19 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %18, !llvm.index.group !11
152 store i32 %16, i32* %19, align 4, !tbaa !9
153 %20 = load i32, i32* %3, align 4, !tbaa !9
154 %21 = load i32, i32* %3, align 4, !tbaa !9
155 %22 = sext i32 %21 to i64
156 ; CHECK-LLVM: getelementptr inbounds [10 x i32], [10 x i32]* %[[EMB_ARRAY_B]], {{.*}}, !llvm.index.group ![[EMB_B_IDX_GR_DIM_1:[0-9]+]]
157 %23 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %22, !llvm.index.group !12
158 store i32 %20, i32* %23, align 4, !tbaa !9
159 %24 = bitcast i32* %5 to i8*
160 call void @llvm.lifetime.start.p0i8(i64 4, i8* %24) #4
161 store i32 0, i32* %5, align 4, !tbaa !9
162 br label %25
163
164 25: ; preds = %66, %15
165 %26 = load i32, i32* %5, align 4, !tbaa !9
166 %27 = icmp ne i32 %26, 10
167 br i1 %27, label %30, label %28
168
169 28: ; preds = %25
170 store i32 5, i32* %4, align 4
171 %29 = bitcast i32* %5 to i8*
172 call void @llvm.lifetime.end.p0i8(i64 4, i8* %29) #4
173 br label %69
174
175 30: ; preds = %25
176 %31 = load i32, i32* %5, align 4, !tbaa !9
177 %32 = load i32, i32* %5, align 4, !tbaa !9
178 %33 = sext i32 %32 to i64
179 ; CHECK-LLVM: getelementptr inbounds [10 x i32], [10 x i32]* %[[EMB_ARRAY_A]], {{.*}}, !llvm.index.group ![[EMB_A_IDX_GR_DIM_2:[0-9]+]]
180 %34 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %33, !llvm.index.group !13
181 %35 = load i32, i32* %34, align 4, !tbaa !9
182 %36 = add nsw i32 %35, %31
183 store i32 %36, i32* %34, align 4, !tbaa !9
184 %37 = load i32, i32* %5, align 4, !tbaa !9
185 %38 = load i32, i32* %5, align 4, !tbaa !9
186 %39 = sext i32 %38 to i64
187 ; CHECK-LLVM: getelementptr inbounds [10 x i32], [10 x i32]* %[[EMB_ARRAY_B]], {{.*}}, !llvm.index.group ![[EMB_B_IDX_GR_DIM_2:[0-9]+]]
188 %40 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %39, !llvm.index.group !15
189 %41 = load i32, i32* %40, align 4, !tbaa !9
190 %42 = add nsw i32 %41, %37
191 store i32 %42, i32* %40, align 4, !tbaa !9
192 %43 = bitcast i32* %6 to i8*
193 call void @llvm.lifetime.start.p0i8(i64 4, i8* %43) #4
194 store i32 0, i32* %6, align 4, !tbaa !9
195 br label %44
196
197 44: ; preds = %62, %30
198 %45 = load i32, i32* %6, align 4, !tbaa !9
199 %46 = icmp ne i32 %45, 10
200 br i1 %46, label %49, label %47
201
202 47: ; preds = %44
203 store i32 8, i32* %4, align 4
204 %48 = bitcast i32* %6 to i8*
205 call void @llvm.lifetime.end.p0i8(i64 4, i8* %48) #4
206 br label %65
207
208 49: ; preds = %44
209 %50 = load i32, i32* %6, align 4, !tbaa !9
210 %51 = load i32, i32* %6, align 4, !tbaa !9
211 %52 = sext i32 %51 to i64
212 ; CHECK-LLVM: getelementptr inbounds [10 x i32], [10 x i32]* %[[EMB_ARRAY_A]], {{.*}}, !llvm.index.group ![[EMB_A_IDX_GR_DIM_3:[0-9]+]]
213 %53 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %52, !llvm.index.group !17
214 %54 = load i32, i32* %53, align 4, !tbaa !9
215 %55 = add nsw i32 %54, %50
216 store i32 %55, i32* %53, align 4, !tbaa !9
217 %56 = load i32, i32* %6, align 4, !tbaa !9
218 %57 = load i32, i32* %6, align 4, !tbaa !9
219 %58 = sext i32 %57 to i64
220 ; CHECK-LLVM: getelementptr inbounds [10 x i32], [10 x i32]* %[[EMB_ARRAY_B]], {{.*}}, !llvm.index.group ![[EMB_B_IDX_GR_DIM_3:[0-9]+]]
221 %59 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %58, !llvm.index.group !19
222 %60 = load i32, i32* %59, align 4, !tbaa !9
223 %61 = add nsw i32 %60, %56
224 store i32 %61, i32* %59, align 4, !tbaa !9
225 br label %62
226
227 62: ; preds = %49
228 %63 = load i32, i32* %6, align 4, !tbaa !9
229 %64 = add nsw i32 %63, 1
230 store i32 %64, i32* %6, align 4, !tbaa !9
231 ; CHECK-LLVM: br label %{{.*}}, !llvm.loop ![[EMB_MD_LOOP_DIM_3:[0-9]+]]
232 br label %44, !llvm.loop !21
233
234 65: ; preds = %47
235 br label %66
236
237 66: ; preds = %65
238 %67 = load i32, i32* %5, align 4, !tbaa !9
239 %68 = add nsw i32 %67, 1
240 store i32 %68, i32* %5, align 4, !tbaa !9
241 ; CHECK-LLVM: br label %{{.*}}, !llvm.loop ![[EMB_MD_LOOP_DIM_2:[0-9]+]]
242 br label %25, !llvm.loop !24
243
244 69: ; preds = %28
245 br label %70
246
247 70: ; preds = %69
248 %71 = load i32, i32* %3, align 4, !tbaa !9
249 %72 = add nsw i32 %71, 1
250 store i32 %72, i32* %3, align 4, !tbaa !9
251 ; CHECK-LLVM: br label %{{.*}}, !llvm.loop ![[EMB_MD_LOOP_DIM_1:[0-9]+]]
252 br label %10, !llvm.loop !26
253
254 73: ; preds = %13
255 %74 = bitcast [10 x i32]* %2 to i8*
256 call void @llvm.lifetime.end.p0i8(i64 40, i8* %74) #4
257 %75 = bitcast [10 x i32]* %1 to i8*
258 call void @llvm.lifetime.end.p0i8(i64 40, i8* %75) #4
259 ret void
260 }
261
262 ; Function Attrs: nounwind
263 define dso_local spir_func void @_Z27ivdep_mul_arrays_and_globalv() #3 {
264 ; CHECK-LLVM: %[[SIMPLE_ARRAY_A:[0-9]+]] = alloca [10 x i32]
265 %1 = alloca [10 x i32], align 4
266 ; CHECK-LLVM: %[[SIMPLE_ARRAY_B:[0-9]+]] = alloca [10 x i32]
267 %2 = alloca [10 x i32], align 4
268 ; CHECK-LLVM: %[[SIMPLE_ARRAY_C:[0-9]+]] = alloca [10 x i32]
269 %3 = alloca [10 x i32], align 4
270 ; CHECK-LLVM: %[[SIMPLE_ARRAY_D:[0-9]+]] = alloca [10 x i32]
271 %4 = alloca [10 x i32], align 4
272 %5 = alloca i32, align 4
273 %6 = bitcast [10 x i32]* %1 to i8*
274 call void @llvm.lifetime.start.p0i8(i64 40, i8* %6) #4
275 %7 = bitcast [10 x i32]* %2 to i8*
276 call void @llvm.lifetime.start.p0i8(i64 40, i8* %7) #4
277 %8 = bitcast [10 x i32]* %3 to i8*
278 call void @llvm.lifetime.start.p0i8(i64 40, i8* %8) #4
279 %9 = bitcast [10 x i32]* %4 to i8*
280 call void @llvm.lifetime.start.p0i8(i64 40, i8* %9) #4
281 %10 = bitcast i32* %5 to i8*
282 call void @llvm.lifetime.start.p0i8(i64 4, i8* %10) #4
283 store i32 0, i32* %5, align 4, !tbaa !9
284 br label %11
285
286 11: ; preds = %29, %0
287 %12 = load i32, i32* %5, align 4, !tbaa !9
288 %13 = icmp ne i32 %12, 10
289 br i1 %13, label %16, label %14
290
291 14: ; preds = %11
292 %15 = bitcast i32* %5 to i8*
293 call void @llvm.lifetime.end.p0i8(i64 4, i8* %15) #4
294 br label %32
295
296 16: ; preds = %11
297 %17 = load i32, i32* %5, align 4, !tbaa !9
298 %18 = sext i32 %17 to i64
299 ; CHECK-LLVM: getelementptr inbounds [10 x i32], [10 x i32]* %[[SIMPLE_ARRAY_A]], {{.*}}, !llvm.index.group ![[SIMPLE_A_IDX_GR:[0-9]+]]
300 %19 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %18, !llvm.index.group !28
301 store i32 0, i32* %19, align 4, !tbaa !9
302 %20 = load i32, i32* %5, align 4, !tbaa !9
303 %21 = sext i32 %20 to i64
304 ; CHECK-LLVM: getelementptr inbounds [10 x i32], [10 x i32]* %[[SIMPLE_ARRAY_B]], {{.*}}, !llvm.index.group ![[SIMPLE_B_IDX_GR:[0-9]+]]
305 %22 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %21, !llvm.index.group !29
306 store i32 0, i32* %22, align 4, !tbaa !9
307 %23 = load i32, i32* %5, align 4, !tbaa !9
308 %24 = sext i32 %23 to i64
309 ; CHECK-LLVM: getelementptr inbounds [10 x i32], [10 x i32]* %[[SIMPLE_ARRAY_C]], {{.*}}, !llvm.index.group ![[SIMPLE_C_IDX_GR:[0-9]+]]
310 %25 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %24, !llvm.index.group !30
311 store i32 0, i32* %25, align 4, !tbaa !9
312 %26 = load i32, i32* %5, align 4, !tbaa !9
313 %27 = sext i32 %26 to i64
314 ; CHECK-LLVM: getelementptr inbounds [10 x i32], [10 x i32]* %[[SIMPLE_ARRAY_D]], {{.*}}, !llvm.index.group ![[SIMPLE_D_IDX_GR:[0-9]+]]
315 %28 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %27, !llvm.index.group !31
316 store i32 0, i32* %28, align 4, !tbaa !9
317 br label %29
318
319 29: ; preds = %16
320 %30 = load i32, i32* %5, align 4, !tbaa !9
321 %31 = add nsw i32 %30, 1
322 store i32 %31, i32* %5, align 4, !tbaa !9
323 ; CHECK-LLVM: br label %{{.*}}, !llvm.loop ![[SIMPLE_MD_LOOP:[0-9]+]]
324 br label %11, !llvm.loop !32
325
326 32: ; preds = %14
327 %33 = bitcast [10 x i32]* %4 to i8*
328 call void @llvm.lifetime.end.p0i8(i64 40, i8* %33) #4
329 %34 = bitcast [10 x i32]* %3 to i8*
330 call void @llvm.lifetime.end.p0i8(i64 40, i8* %34) #4
331 %35 = bitcast [10 x i32]* %2 to i8*
332 call void @llvm.lifetime.end.p0i8(i64 40, i8* %35) #4
333 %36 = bitcast [10 x i32]* %1 to i8*
334 call void @llvm.lifetime.end.p0i8(i64 40, i8* %36) #4
335 ret void
336 }
337
338 ; Function Attrs: norecurse nounwind
339 define dso_local spir_func void @_Z27ivdep_embedded_inner_accessv() #3 {
340 ; CHECK-LLVM: %[[EMB_INNER_ARRAY_A:[0-9]+]] = alloca [10 x [10 x [10 x i32]]]
341 %1 = alloca [10 x [10 x [10 x i32]]], align 4
342 ; CHECK-LLVM: %[[EMB_INNER_ARRAY_B:[0-9]+]] = alloca [10 x [10 x [10 x i32]]]
343 %2 = alloca [10 x [10 x [10 x i32]]], align 4
344 %3 = alloca i32, align 4
345 %4 = alloca i32, align 4
346 %5 = alloca i32, align 4
347 %6 = alloca i32, align 4
348 %7 = bitcast [10 x [10 x [10 x i32]]]* %1 to i8*
349 call void @llvm.lifetime.start.p0i8(i64 4000, i8* %7) #4
350 %8 = bitcast [10 x [10 x [10 x i32]]]* %2 to i8*
351 call void @llvm.lifetime.start.p0i8(i64 4000, i8* %8) #4
352 %9 = bitcast i32* %3 to i8*
353 call void @llvm.lifetime.start.p0i8(i64 4, i8* %9) #4
354 store i32 0, i32* %3, align 4, !tbaa !9
355 br label %10
356
357 10: ; preds = %57, %0
358 %11 = load i32, i32* %3, align 4, !tbaa !9
359 %12 = icmp ne i32 %11, 10
360 br i1 %12, label %15, label %13
361
362 13: ; preds = %10
363 store i32 2, i32* %4, align 4
364 %14 = bitcast i32* %3 to i8*
365 call void @llvm.lifetime.end.p0i8(i64 4, i8* %14) #4
366 br label %60
367
368 15: ; preds = %10
369 %16 = bitcast i32* %5 to i8*
370 call void @llvm.lifetime.start.p0i8(i64 4, i8* %16) #4
371 store i32 0, i32* %5, align 4, !tbaa !9
372 br label %17
373
374 17: ; preds = %53, %15
375 %18 = load i32, i32* %5, align 4, !tbaa !9
376 %19 = icmp ne i32 %18, 10
377 br i1 %19, label %22, label %20
378
379 20: ; preds = %17
380 store i32 5, i32* %4, align 4
381 %21 = bitcast i32* %5 to i8*
382 call void @llvm.lifetime.end.p0i8(i64 4, i8* %21) #4
383 br label %56
384
385 22: ; preds = %17
386 %23 = bitcast i32* %6 to i8*
387 call void @llvm.lifetime.start.p0i8(i64 4, i8* %23) #4
388 store i32 0, i32* %6, align 4, !tbaa !9
389 br label %24
390
391 24: ; preds = %49, %22
392 %25 = load i32, i32* %6, align 4, !tbaa !9
393 %26 = icmp ne i32 %25, 10
394 br i1 %26, label %29, label %27
395
396 27: ; preds = %24
397 store i32 8, i32* %4, align 4
398 %28 = bitcast i32* %6 to i8*
399 call void @llvm.lifetime.end.p0i8(i64 4, i8* %28) #4
400 br label %52
401
402 29: ; preds = %24
403 %30 = load i32, i32* %3, align 4, !tbaa !9
404 %31 = sext i32 %30 to i64
405 ; CHECK-LLVM: getelementptr inbounds [10 x [10 x [10 x i32]]], [10 x [10 x [10 x i32]]]* %[[EMB_INNER_ARRAY_B]], {{.*}}, !llvm.index.group ![[EMB_INNER_B_IDX_GR:[0-9]+]]
406 %32 = getelementptr inbounds [10 x [10 x [10 x i32]]], [10 x [10 x [10 x i32]]]* %2, i64 0, i64 %31, !llvm.index.group !37
407 %33 = load i32, i32* %5, align 4, !tbaa !9
408 %34 = sext i32 %33 to i64
409 %35 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %32, i64 0, i64 %34
410 %36 = load i32, i32* %6, align 4, !tbaa !9
411 %37 = sext i32 %36 to i64
412 %38 = getelementptr inbounds [10 x i32], [10 x i32]* %35, i64 0, i64 %37
413 %39 = load i32, i32* %38, align 4, !tbaa !9
414 %40 = load i32, i32* %3, align 4, !tbaa !9
415 %41 = sext i32 %40 to i64
416 ; CHECK-LLVM: getelementptr inbounds [10 x [10 x [10 x i32]]], [10 x [10 x [10 x i32]]]* %[[EMB_INNER_ARRAY_A]], {{.*}}, !llvm.index.group ![[EMB_INNER_A_IDX_GR:[0-9]+]]
417 %42 = getelementptr inbounds [10 x [10 x [10 x i32]]], [10 x [10 x [10 x i32]]]* %1, i64 0, i64 %41, !llvm.index.group !41
418 %43 = load i32, i32* %5, align 4, !tbaa !9
419 %44 = sext i32 %43 to i64
420 %45 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %42, i64 0, i64 %44
421 %46 = load i32, i32* %6, align 4, !tbaa !9
422 %47 = sext i32 %46 to i64
423 %48 = getelementptr inbounds [10 x i32], [10 x i32]* %45, i64 0, i64 %47
424 store i32 %39, i32* %48, align 4, !tbaa !9
425 br label %49
426
427 49: ; preds = %29
428 %50 = load i32, i32* %6, align 4, !tbaa !9
429 %51 = add nsw i32 %50, 1
430 store i32 %51, i32* %6, align 4, !tbaa !9
431 ; CHECK-LLVM: br label %{{.*}}, !llvm.loop ![[EMB_INNER_MD_LOOP_DIM_3:[0-9]+]]
432 br label %24, !llvm.loop !45
433
434 52: ; preds = %27
435 br label %53
436
437 53: ; preds = %52
438 %54 = load i32, i32* %5, align 4, !tbaa !9
439 %55 = add nsw i32 %54, 1
440 store i32 %55, i32* %5, align 4, !tbaa !9
441 ; CHECK-LLVM: br label %{{.*}}, !llvm.loop ![[EMB_INNER_MD_LOOP_DIM_2:[0-9]+]]
442 br label %17, !llvm.loop !47
443
444 56: ; preds = %20
445 br label %57
446
447 57: ; preds = %56
448 %58 = load i32, i32* %3, align 4, !tbaa !9
449 %59 = add nsw i32 %58, 1
450 store i32 %59, i32* %3, align 4, !tbaa !9
451 ; CHECK-LLVM: br label %{{.*}}, !llvm.loop ![[EMB_INNER_MD_LOOP_DIM_1:[0-9]+]]
452 br label %10, !llvm.loop !49
453
454 60: ; preds = %13
455 %61 = bitcast [10 x [10 x [10 x i32]]]* %2 to i8*
456 call void @llvm.lifetime.end.p0i8(i64 4000, i8* %61) #4
457 %62 = bitcast [10 x [10 x [10 x i32]]]* %1 to i8*
458 call void @llvm.lifetime.end.p0i8(i64 4000, i8* %62) #4
459 ret void
460 }
461
462 attributes #0 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "sycl-module-id"="ivdep-spirv.cpp" "uniform-work-group-size"="true" "unsafe-fp-math"="false" "use-soft-float"="false" }
463 attributes #1 = { argmemonly nounwind willreturn }
464 attributes #2 = { inlinehint nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
465 attributes #3 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
466 attributes #4 = { nounwind }
467
468 !llvm.module.flags = !{!0}
469 !opencl.spir.version = !{!1}
470 !spirv.Source = !{!2}
471 !llvm.ident = !{!3}
472
473 !0 = !{i32 1, !"wchar_size", i32 4}
474 !1 = !{i32 1, i32 2}
475 !2 = !{i32 4, i32 100000}
476 !3 = !{!"clang version 10.0.0"}
477 !4 = !{}
478 !5 = !{!6, !6, i64 0}
479 !6 = !{!"any pointer", !7, i64 0}
480 !7 = !{!"omnipotent char", !8, i64 0}
481 !8 = !{!"Simple C++ TBAA"}
482 !9 = !{!10, !10, i64 0}
483 !10 = !{!"int", !7, i64 0}
484 ; Legacy metadata
485 ; CHECK-LLVM-DAG: ![[IVDEP_LEGACY:[0-9]+]] = !{!"llvm.loop.ivdep.enable"}
486 ;
487 ; Accesses within each dimension of a multi-dimensional (n > 2) loop
488 ; Index group(s) of each inner loop should have a subnode that points to the containing loop's index group subnode
489 ;
490 ; Loop dimension 3 (the innermost loop)
491 ; CHECK-LLVM-DAG: ![[EMB_A_IDX_GR_DIM_3]] = !{![[EMB_A_IDX_GR_DIM_1]], ![[EMB_A_IDX_NODE_DIM_2:[0-9]+]], ![[EMB_A_IDX_NODE_DIM_3:[0-9]+]]}
492 ; CHECK-LLVM-DAG: ![[EMB_A_IDX_NODE_DIM_3]] = distinct !{}
493 ; CHECK-LLVM-DAG: ![[EMB_B_IDX_GR_DIM_3]] = !{![[EMB_B_IDX_GR_DIM_1]], ![[EMB_B_IDX_NODE_DIM_2:[0-9]+]], ![[EMB_B_IDX_NODE_DIM_3:[0-9]+]]}
494 ; CHECK-LLVM-DAG: ![[EMB_B_IDX_NODE_DIM_3]] = distinct !{}
495 ; CHECK-LLVM-DAG: ![[EMB_MD_LOOP_DIM_3]] = distinct !{![[EMB_MD_LOOP_DIM_3]], ![[IVDEP_LEGACY]], ![[EMB_IVDEP_DIM_3:[0-9]+]]{{.*}}}
496 ; The next directives should overlap
497 ; CHECK-LLVM-MD-OP1-DAG: ![[EMB_IVDEP_DIM_3]] = !{!"llvm.loop.parallel_access_indices",{{.*}} ![[EMB_A_IDX_NODE_DIM_3]]{{.*}}}
498 ; CHECK-LLVM-MD-OP2-DAG: ![[EMB_IVDEP_DIM_3]] = !{!"llvm.loop.parallel_access_indices",{{.*}} ![[EMB_B_IDX_NODE_DIM_3]]{{.*}}}
499 ;
500 ; Loop dimension 2
501 ; CHECK-LLVM-DAG: ![[EMB_A_IDX_GR_DIM_2]] = !{![[EMB_A_IDX_GR_DIM_1]], ![[EMB_A_IDX_NODE_DIM_2]]}
502 ; CHECK-LLVM-DAG: ![[EMB_A_IDX_NODE_DIM_2]] = distinct !{}
503 ; CHECK-LLVM-DAG: ![[EMB_B_IDX_GR_DIM_2]] = !{![[EMB_B_IDX_GR_DIM_1]], ![[EMB_B_IDX_NODE_DIM_2]]}
504 ; CHECK-LLVM-DAG: ![[EMB_B_IDX_NODE_DIM_2]] = distinct !{}
505 ; CHECK-LLVM-DAG: ![[EMB_MD_LOOP_DIM_2]] = distinct !{![[EMB_MD_LOOP_DIM_2]], ![[IVDEP_LEGACY]], ![[EMB_IVDEP_DIM_2:[0-9]+]]}
506 ; The next directives should overlap
507 ; CHECK-LLVM-MD-OP1-DAG: ![[EMB_IVDEP_DIM_2]] = !{!"llvm.loop.parallel_access_indices",{{.*}} ![[EMB_A_IDX_NODE_DIM_2]]{{.*}}}
508 ; CHECK-LLVM-MD-OP2-DAG: ![[EMB_IVDEP_DIM_2]] = !{!"llvm.loop.parallel_access_indices",{{.*}} ![[EMB_B_IDX_NODE_DIM_2]]{{.*}}}
509 ;
510 ; Loop dimension 1 (the outermost loop)
511 ; CHECK-LLVM-DAG: ![[EMB_A_IDX_GR_DIM_1]] = distinct !{}
512 ; CHECK-LLVM-DAG: ![[EMB_MD_LOOP_DIM_1]] = distinct !{![[EMB_MD_LOOP_DIM_1]], ![[IVDEP_LEGACY]], ![[EMB_IVDEP_DIM_1:[0-9]+]]}
513 ; The next directives should overlap
514 ; CHECK-LLVM-MD-OP1-DAG: ![[EMB_IVDEP_DIM_1]] = !{!"llvm.loop.parallel_access_indices",{{.*}} ![[EMB_A_IDX_GR_DIM_1]]{{.*}}}
515 ; CHECK-LLVM-MD-OP2-DAG: ![[EMB_IVDEP_DIM_1]] = !{!"llvm.loop.parallel_access_indices",{{.*}} ![[EMB_B_IDX_GR_DIM_1]]{{.*}}}
516 !11 = distinct !{}
517 !12 = distinct !{}
518 !13 = !{!11, !14}
519 !14 = distinct !{}
520 !15 = !{!12, !16}
521 !16 = distinct !{}
522 !17 = !{!11, !14, !18}
523 !18 = distinct !{}
524 !19 = !{!12, !16, !20}
525 !20 = distinct !{}
526 !21 = distinct !{!21, !22, !23}
527 !22 = !{!"llvm.loop.parallel_access_indices", !18, !20}
528 !23 = !{!"llvm.loop.ivdep.enable"}
529 !24 = distinct !{!24, !25, !23}
530 !25 = !{!"llvm.loop.parallel_access_indices", !14, !16}
531 !26 = distinct !{!26, !27, !23}
532 !27 = !{!"llvm.loop.parallel_access_indices", !11, !12}
533 ; Multiple arrays with specific safelens in a simple one-dimensional loop
534 ; CHECK-LLVM-DAG: ![[SIMPLE_A_IDX_GR]] = distinct !{}
535 ; CHECK-LLVM-DAG: ![[SIMPLE_B_IDX_GR]] = distinct !{}
536 ; CHECK-LLVM-DAG: ![[SIMPLE_C_IDX_GR]] = distinct !{}
537 ; CHECK-LLVM-DAG: ![[SIMPLE_D_IDX_GR]] = distinct !{}
538 !28 = distinct !{}
539 !29 = distinct !{}
540 !30 = distinct !{}
541 !31 = distinct !{}
542 ; Legacy metadata
543 ; CHECK-LLVM-DAG: ![[IVDEP_LEGACY_SAFELEN_5:[0-9]+]] = !{!"llvm.loop.ivdep.safelen", i32 5}
544 ;
545 ; CHECK-LLVM-DAG: ![[SIMPLE_MD_LOOP]] = distinct !{![[SIMPLE_MD_LOOP]], ![[IVDEP_LEGACY_SAFELEN_5]], ![[SIMPLE_IVDEP_C:[0-9]+]], ![[SIMPLE_IVDEP_A_D:[0-9]+]], ![[SIMPLE_IVDEP_B:[0-9]+]]}
546 !32 = distinct !{!32, !33, !34, !35, !36}
547 ; The next directives should overlap
548 ; CHECK-LLVM-MD-OP1-DAG: ![[SIMPLE_IVDEP_A_D]] = !{!"llvm.loop.parallel_access_indices",{{.*}} ![[SIMPLE_A_IDX_GR]],{{.*}} i32 5}
549 ; CHECK-LLVM-MD-OP2-DAG: ![[SIMPLE_IVDEP_A_D]] = !{!"llvm.loop.parallel_access_indices",{{.*}} ![[SIMPLE_D_IDX_GR]],{{.*}} i32 5}
550 !33 = !{!"llvm.loop.parallel_access_indices", !28, !31, i32 5}
551 !34 = !{!"llvm.loop.ivdep.safelen", i32 5}
552 ; CHECK-LLVM-DAG: ![[SIMPLE_IVDEP_B]] = !{!"llvm.loop.parallel_access_indices", ![[SIMPLE_B_IDX_GR]], i32 6}
553 !35 = !{!"llvm.loop.parallel_access_indices", !29, i32 6}
554 ; CHECK-LLVM-DAG: ![[SIMPLE_IVDEP_C]] = !{!"llvm.loop.parallel_access_indices", ![[SIMPLE_C_IDX_GR]]}
555 !36 = !{!"llvm.loop.parallel_access_indices", !30}
556 ; Accesses within the inner loop of a multi-dimensional (n > 2) loop nest
557 ;
558 ; Loop dimension 3 (the innermost loop)
559 ; CHECK-LLVM-DAG: ![[EMB_INNER_A_IDX_GR]] = !{![[EMB_INNER_A_IDX_NODE_DIM_1:[0-9]+]], ![[EMB_INNER_A_IDX_NODE_DIM_2:[0-9]+]], ![[EMB_INNER_A_IDX_NODE_DIM_3:[0-9]+]]}
560 ; CHECK-LLVM-DAG: ![[EMB_INNER_A_IDX_NODE_DIM_3]] = distinct !{}
561 ; CHECK-LLVM-DAG: ![[EMB_INNER_B_IDX_GR]] = !{![[EMB_INNER_B_IDX_NODE_DIM_1:[0-9]+]], ![[EMB_INNER_B_IDX_NODE_DIM_2:[0-9]+]], ![[EMB_INNER_B_IDX_NODE_DIM_3:[0-9]+]]}
562 ; CHECK-LLVM-DAG: ![[EMB_INNER_B_IDX_NODE_DIM_3]] = distinct !{}
563 ; CHECK-LLVM-DAG: ![[EMB_INNER_MD_LOOP_DIM_3]] = distinct !{![[EMB_INNER_MD_LOOP_DIM_3]], ![[IVDEP_LEGACY]], ![[EMB_INNER_IVDEP_DIM_3:[0-9]+]]{{.*}}}
564 ; The next directives should overlap
565 ; CHECK-LLVM-MD-OP1-DAG: ![[EMB_INNER_IVDEP_DIM_3]] = !{!"llvm.loop.parallel_access_indices",{{.*}} ![[EMB_INNER_A_IDX_NODE_DIM_3]]{{.*}}}
566 ; CHECK-LLVM-MD-OP2-DAG: ![[EMB_INNER_IVDEP_DIM_3]] = !{!"llvm.loop.parallel_access_indices",{{.*}} ![[EMB_INNER_B_IDX_NODE_DIM_3]]{{.*}}}
567 ;
568 ; Loop dimension 2
569 ; CHECK-LLVM-DAG: ![[EMB_INNER_A_IDX_NODE_DIM_2]] = distinct !{}
570 ; CHECK-LLVM-DAG: ![[EMB_INNER_B_IDX_NODE_DIM_2]] = distinct !{}
571 ; CHECK-LLVM-DAG: ![[EMB_INNER_MD_LOOP_DIM_2]] = distinct !{![[EMB_INNER_MD_LOOP_DIM_2]], ![[IVDEP_LEGACY]], ![[EMB_INNER_IVDEP_DIM_2:[0-9]+]]}
572 ; The next directives should overlap
573 ; CHECK-LLVM-MD-OP1-DAG: ![[EMB_INNER_IVDEP_DIM_2]] = !{!"llvm.loop.parallel_access_indices",{{.*}} ![[EMB_INNER_A_IDX_NODE_DIM_2]]{{.*}}}
574 ; CHECK-LLVM-MD-OP2-DAG: ![[EMB_INNER_IVDEP_DIM_2]] = !{!"llvm.loop.parallel_access_indices",{{.*}} ![[EMB_INNER_B_IDX_NODE_DIM_2]]{{.*}}}
575 ;
576 ; Loop dimension 1 (the outermost loop)
577 ; CHECK-LLVM-DAG: ![[EMB_INNER_A_IDX_NODE_DIM_1]] = distinct !{}
578 ; CHECK-LLVM-DAG: ![[EMB_INNER_B_IDX_NODE_DIM_1]] = distinct !{}
579 ; CHECK-LLVM-DAG: ![[EMB_INNER_MD_LOOP_DIM_1]] = distinct !{![[EMB_INNER_MD_LOOP_DIM_1]], ![[IVDEP_LEGACY]], ![[EMB_INNER_IVDEP_DIM_1:[0-9]+]]}
580 ; The next directives should overlap
581 ; CHECK-LLVM-MD-OP1-DAG: ![[EMB_INNER_IVDEP_DIM_1]] = !{!"llvm.loop.parallel_access_indices",{{.*}} ![[EMB_INNER_A_IDX_NODE_DIM_1]]{{.*}}}
582 ; CHECK-LLVM-MD-OP2-DAG: ![[EMB_INNER_IVDEP_DIM_1]] = !{!"llvm.loop.parallel_access_indices",{{.*}} ![[EMB_INNER_B_IDX_NODE_DIM_1]]{{.*}}}
583 !37 = !{!38, !39, !40}
584 !38 = distinct !{}
585 !39 = distinct !{}
586 !40 = distinct !{}
587 !41 = !{!42, !43, !44}
588 !42 = distinct !{}
589 !43 = distinct !{}
590 !44 = distinct !{}
591 !45 = distinct !{!45, !46, !23}
592 !46 = !{!"llvm.loop.parallel_access_indices", !40, !44}
593 !47 = distinct !{!47, !48, !23}
594 !48 = !{!"llvm.loop.parallel_access_indices", !39, !43}
595 !49 = distinct !{!49, !50, !23}
596 !50 = !{!"llvm.loop.parallel_access_indices", !38, !42}