Debian Codegraph @

IGC/ocloc_tests/SPIRV-extenstions/SPV_INTEL_unstructured_loop_controls/InfiniteLoopMetadataPlacement.ll

raw
1 ; UNSUPPORTED: system-windows
2 ; REQUIRES: llvm-spirv, regkeys, dg2-supported
3
4 ; RUN: llvm-as %s -o %t.bc
5 ; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_INTEL_unstructured_loop_controls -o %t.spv
6 ; RUN: ocloc compile -spirv_input -file %t.spv -device dg2 -options " -igc_opts 'ShaderDumpTranslationOnly=1'" 2>&1 | FileCheck %s --check-prefixes=CHECK-LLVM
7
8 ; ModuleID = 'llvm_loop_test.cpp'
9 source_filename = "llvm_loop_test.cpp"
10 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
11 target triple = "spir64-unknown-unknown"
12
13 $_ZTS12WhileOneTest = comdat any
14
15 ; Function Attrs: inlinehint nounwind
16 define weak_odr dso_local spir_kernel void @_ZTS12WhileOneTest() #0 comdat !kernel_arg_addr_space !4 !kernel_arg_access_qual !4 !kernel_arg_type !4 !kernel_arg_base_type !4 !kernel_arg_type_qual !4 {
17 entry:
18 %i = alloca i32, align 4
19 %s = alloca i32, align 4
20 %0 = bitcast i32* %i to i8*
21 call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #2
22 store i32 0, i32* %i, align 4, !tbaa !7
23 %1 = bitcast i32* %s to i8*
24 call void @llvm.lifetime.start.p0i8(i64 4, i8* %1) #2
25 store i32 0, i32* %s, align 4, !tbaa !7
26 br label %while.cond
27
28 while.cond: ; preds = %if.end, %entry
29 br label %while.body
30
31 while.body: ; preds = %while.cond
32 %2 = load i32, i32* %i, align 4, !tbaa !7
33 %cmp = icmp sge i32 %2, 16
34 br i1 %cmp, label %if.then, label %if.else
35
36 if.then: ; preds = %while.body
37 call spir_func void @_Z1fv() #0
38 br label %while.end
39
40 if.else: ; preds = %while.body
41 %3 = load i32, i32* %i, align 4, !tbaa !7
42 %4 = load i32, i32* %s, align 4, !tbaa !7
43 %add = add nsw i32 %4, %3
44 store i32 %add, i32* %s, align 4, !tbaa !7
45 br label %if.end
46
47 ; CHECK-LLVM-NOT: br {{.*}}, !llvm.loop
48
49 if.end: ; preds = %if.else
50 ; CHECK-LLVM: if.end:
51 %5 = load i32, i32* %i, align 4, !tbaa !7
52 %inc = add nsw i32 %5, 1
53 store i32 %inc, i32* %i, align 4, !tbaa !7
54 br label %while.cond, !llvm.loop !9
55 ; CHECK-LLVM: br label %while.cond, !llvm.loop ![[MD_UNROLL:[0-9]+]]
56
57 ; CHECK-LLVM-NOT: br {{.*}}, !llvm.loop
58
59 while.end: ; preds = %if.then
60 %6 = bitcast i32* %s to i8*
61 call void @llvm.lifetime.end.p0i8(i64 4, i8* %6) #2
62 %7 = bitcast i32* %i to i8*
63 call void @llvm.lifetime.end.p0i8(i64 4, i8* %7) #2
64 ret void
65 }
66
67 ; Function Attrs: nounwind
68 define spir_func void @_Z1fv() #0 {
69 entry:
70 ret void
71 }
72
73 ; Function Attrs: argmemonly nounwind
74 declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #1
75
76 ; Function Attrs: argmemonly nounwind
77 declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #1
78
79 attributes #0 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "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" "uniform-work-group-size"="true" "unsafe-fp-math"="false" "use-soft-float"="false" }
80 attributes #1 = { argmemonly nounwind }
81 attributes #2 = { nounwind }
82
83 !llvm.module.flags = !{!0}
84 !opencl.spir.version = !{!1}
85 !spirv.Source = !{!2}
86 !llvm.ident = !{!3}
87
88 !0 = !{i32 1, !"wchar_size", i32 4}
89 !1 = !{i32 1, i32 2}
90 !2 = !{i32 4, i32 100000}
91 !3 = !{!"clang version 9.0.0"}
92 !4 = !{}
93 !5 = !{!"omnipotent char", !6, i64 0}
94 !6 = !{!"Simple C++ TBAA"}
95 !7 = !{!8, !8, i64 0}
96 !8 = !{!"int", !5, i64 0}
97 !9 = distinct !{!9, !10}
98 !10 = !{!"llvm.loop.unroll.enable"}
99
100 ; CHECK-LLVM: ![[MD_UNROLL]] = distinct !{![[MD_UNROLL]], ![[MD_unroll_enable:[0-9]+]]}
101 ; CHECK-LLVM: ![[MD_unroll_enable]] = !{!"llvm.loop.unroll.enable"}