Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/create-placeholders-for-phi-operands.ll

raw
1 ; RUN: llvm-as %s -o %t.bc
2 ; RUN: llvm-spirv %t.bc -o %t.spv -spirv-ext=+SPV_INTEL_variable_length_array
3 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.rev.bc
4 ; RUN: llvm-dis %t.rev.bc -o %t.rev.ll
5 ; RUN: FileCheck %s --input-file %t.rev.ll --check-prefix CHECK-LLVM
6
7 ; CHECK-LLVM: phi ptr [ [[savedstack:%.*]], {{.*}} ], [ [[savedstack_us:%.*]], {{.*}} ]
8
9 ; CHECK-LLVM: BB.{{[0-9]+}}:
10 ; CHECK-LLVM: [[savedstack]] = call ptr @llvm.stacksave()
11
12 ; CHECK-LLVM: BB.{{[0-9]+}}:
13 ; CHECK-LLVM: [[savedstack_us]] = call ptr @llvm.stacksave()
14
15 ; ModuleID = 's.bc'
16 source_filename = "llvm-link"
17 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
18 target triple = "spir64"
19
20 ; Function Attrs: noinline nounwind mustprogress
21 define weak dso_local spir_kernel void @Kernel(i32 addrspace(1)* %0, i32 addrspace(1)* %1, i64 %.omp.lb.ascast.val109.zext, i64 %.omp.ub.ascast.val.zext, i64 %.capture_expr.0.ascast.val.zext, i64 %length_.ascast.val.zext) local_unnamed_addr #0 {
22 BB.0:
23 %dmt.i = alloca [624 x i32], align 4
24 %length_.ascast.val.zext.trunc = trunc i64 %length_.ascast.val.zext to i32
25 %.capture_expr.0.ascast.val.zext.trunc = trunc i64 %.capture_expr.0.ascast.val.zext to i32
26 %.omp.ub.ascast.val.zext.trunc = trunc i64 %.omp.ub.ascast.val.zext to i32
27 %.omp.lb.ascast.val109.zext.trunc = trunc i64 %.omp.lb.ascast.val109.zext to i32
28 %cmp41 = icmp slt i32 %.capture_expr.0.ascast.val.zext.trunc, 1
29 %cmp42.not104 = icmp sgt i32 %.omp.lb.ascast.val109.zext.trunc, %.omp.ub.ascast.val.zext.trunc
30 %or.cond = select i1 %cmp41, i1 true, i1 %cmp42.not104
31 br i1 %or.cond, label %BB.2, label %BB.3
32
33 BB.1: ; preds = %BB.12.loopexit, %BB.11.loopexit
34 %savedstack.sink = phi i8* [ %savedstack, %BB.12.loopexit ], [ %savedstack.us, %BB.11.loopexit ]
35 call void @llvm.stackrestore(i8* %savedstack.sink), !llvm.access.group !9
36 br label %BB.2
37
38 BB.2: ; preds = %BB.3, %BB.1, %BB.0
39 ret void
40
41 BB.3: ; preds = %BB.0
42 %2 = call spir_func i64 @_Z13get_global_idj(i32 0)
43 %3 = trunc i64 %2 to i32
44 %.not = icmp sgt i32 %3, %.omp.ub.ascast.val.zext.trunc
45 br i1 %.not, label %BB.2, label %BB.4, !prof !10
46
47 BB.4: ; preds = %BB.3
48 %div.i = udiv i32 %length_.ascast.val.zext.trunc, 624
49 %4 = icmp ult i32 %length_.ascast.val.zext.trunc, 624
50 br i1 %4, label %BB.5, label %BB.6
51
52 BB.5: ; preds = %BB.4
53 %savedstack = call i8* @llvm.stacksave(), !llvm.access.group !9
54 br label %BB.12
55
56 BB.6: ; preds = %BB.4
57 %5 = icmp ugt i32 %div.i, 1
58 %umax = select i1 %5, i32 %div.i, i32 1
59 %arrayidx4812.us = getelementptr inbounds i32, i32 addrspace(1)* %0, i64 %2
60 %arrayidx5113.us = getelementptr inbounds i32, i32 addrspace(1)* %1, i64 %2
61 %savedstack.us = call i8* @llvm.stacksave(), !llvm.access.group !9
62 br label %BB.9
63
64 BB.7: ; preds = %BB.8
65 %indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
66 %exitcond29.not = icmp eq i64 %indvars.iv.next27, %7
67 br i1 %exitcond29.not, label %BB.11.loopexit, label %BB.11, !llvm.loop !11
68
69 BB.11.loopexit:
70 br label %BB.1
71
72 BB.8: ; preds = %BB.11, %BB.8
73 %indvars.iv22 = phi i64 [ 0, %BB.11 ], [ %indvars.iv.next23, %BB.8 ]
74 %j.0.i17.us = phi i32 [ 0, %BB.11 ], [ %add.i.us, %BB.8 ]
75 %arrayidx1276.i.us = getelementptr inbounds [624 x i32], [624 x i32]* %dmt.i, i64 0, i64 %indvars.iv22
76 %6 = load i32, i32* %arrayidx1276.i.us, align 4, !alias.scope !14, !noalias !19, !llvm.access.group !9
77 %and.i.us = and i32 %6, -2147483648
78 %indvars.iv.next23 = add nuw nsw i64 %indvars.iv22, 1
79 %add.i.us = add nuw nsw i32 %j.0.i17.us, 1
80 %exitcond25.not = icmp eq i64 %indvars.iv.next23, 624
81 br i1 %exitcond25.not, label %BB.7, label %BB.8, !llvm.loop !26
82
83 BB.9: ; preds = %BB.9, %BB.6
84 %indvars.iv = phi i64 [ %indvars.iv.next, %BB.9 ], [ 0, %BB.6 ]
85 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
86 %exitcond.not = icmp eq i64 %indvars.iv.next, 624
87 br i1 %exitcond.not, label %BB.10, label %BB.9, !llvm.loop !28
88
89 BB.10: ; preds = %BB.9
90 %7 = zext i32 %umax to i64
91 br label %BB.11
92
93 BB.11: ; preds = %BB.10, %BB.7
94 %indvars.iv26 = phi i64 [ 0, %BB.10 ], [ %indvars.iv.next27, %BB.7 ]
95 %8 = mul nuw nsw i64 %indvars.iv26, 624
96 br label %BB.8
97
98 BB.12: ; preds = %BB.12, %BB.5
99 %indvars.iv33 = phi i64 [ 0, %BB.5 ], [ %indvars.iv.next34, %BB.12 ]
100 %indvars.iv.next34 = add nuw nsw i64 %indvars.iv33, 1
101 %exitcond35.not = icmp eq i64 %indvars.iv.next34, 624
102 br i1 %exitcond35.not, label %BB.12.loopexit, label %BB.12, !llvm.loop !11
103
104 BB.12.loopexit:
105 br label %BB.1
106 }
107
108 declare spir_func i64 @_Z13get_global_idj(i32) local_unnamed_addr
109
110 ; Function Attrs: nofree nosync nounwind willreturn
111 declare i8* @llvm.stacksave() #1
112
113 ; Function Attrs: nofree nosync nounwind willreturn
114 declare void @llvm.stackrestore(i8*) #1
115
116 attributes #0 = { noinline nounwind mustprogress "contains-openmp-target"="true" "denormal-fp-math"="preserve-sign,preserve-sign" "denormal-fp-math-f32"="ieee,ieee" "frame-pointer"="all" "may-have-openmp-directive"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target.declare"="true" "unsafe-fp-math"="true" }
117 attributes #1 = { nofree nosync nounwind willreturn }
118
119 !opencl.used.extensions = !{!0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0}
120 !opencl.used.optional.core.features = !{!1, !0, !0, !0, !1, !0, !1, !0, !1, !0, !1, !0, !0, !0}
121 !opencl.compiler.options = !{!0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0, !0}
122 !llvm.ident = !{!2, !2, !2, !2, !2, !2, !2, !2, !2, !2, !2, !2, !2, !2, !2, !2, !2, !2, !2, !2}
123 !spirv.Source = !{!3, !4, !3, !3, !3, !3, !3, !3, !3, !3, !3, !3, !3, !3, !3}
124 !spirv.MemoryModel = !{!5}
125 !spirv.ExecutionMode = !{}
126 !llvm.module.flags = !{!6, !7, !8}
127 !sycl.specialization-constants = !{}
128
129 !0 = !{}
130 !1 = !{!"cl_doubles"}
131 !2 = !{!"Compiler"}
132 !3 = !{i32 4, i32 200000}
133 !4 = !{i32 3, i32 200000}
134 !5 = !{i32 2, i32 2}
135 !6 = !{i32 1, !"wchar_size", i32 4}
136 !7 = !{i32 7, !"PIC Level", i32 2}
137 !8 = !{i32 7, !"frame-pointer", i32 2}
138 !9 = distinct !{}
139 !10 = !{!"branch_weights", i32 100000, i32 299998}
140 !11 = distinct !{!11, !12, !13}
141 !12 = !{!"llvm.loop.vectorize.ivdep_loop", i32 0}
142 !13 = !{!"llvm.loop.parallel_accesses", !9}
143 !14 = !{!15, !17}
144 !15 = distinct !{!15, !16}
145 !16 = distinct !{!16}
146 !17 = distinct !{!17, !18}
147 !18 = distinct !{!18}
148 !19 = !{!20, !21, !22, !23, !24, !25}
149 !20 = distinct !{!20, !16}
150 !21 = distinct !{!21, !16}
151 !22 = distinct !{!22, !18}
152 !23 = distinct !{!23, !18}
153 !24 = distinct !{!24, !18}
154 !25 = distinct !{!25, !18}
155 !26 = distinct !{!26, !27}
156 !27 = !{!"llvm.loop.mustprogress"}
157 !28 = distinct !{!28, !27}