15
15
%class.specialization_id.2 = type { %struct.ComposConst2 }
16
16
%struct.ComposConst2 = type { i8 , %struct.myConst , double }
17
17
18
+ %struct.VectorConst = type { <2 x i32 > }
19
+ %class.specialization_id.3 = type { %struct.VectorConst }
20
+ %struct.MArrayConst = type { [2 x i32 ] }
21
+ %class.specialization_id.4 = type { %struct.MArrayConst }
22
+ %struct.MArrayConst2 = type { [3 x i32 ] }
23
+ %class.specialization_id.5 = type { %struct.MArrayConst2 }
24
+ %struct.MArrayConst3 = type { [3 x i64 ] }
25
+ %class.specialization_id.6 = type { %struct.MArrayConst3 }
26
+ %struct.MArrayConst4 = type { [2 x [2 x [3 x i32 ]]] }
27
+ %class.specialization_id.7 = type { %struct.MArrayConst4 }
28
+
18
29
@id_half = dso_local global %class.specialization_id { half 0xH4000 }, align 8
19
30
@id_int = dso_local global %class.specialization_id.0 { i32 42 }, align 4
20
31
@id_compos = dso_local global %class.specialization_id.1 { %struct.ComposConst { i32 1 , double 2 .000000e+00 , %struct.myConst { i32 13 , float 0x4020666660000000 } } }, align 8
21
32
@id_compos2 = dso_local global %class.specialization_id.2 { %struct.ComposConst2 { i8 1 , %struct.myConst { i32 52 , float 0x40479999A0000000 }, double 2 .000000e+00 } }, align 8
33
+ @id_vector = dso_local global %class.specialization_id.3 { %struct.VectorConst { <2 x i32 > <i32 1 , i32 2 > } }, align 8
34
+ @id_marray = dso_local global %class.specialization_id.4 { %struct.MArrayConst { [2 x i32 ] [i32 1 , i32 2 ] } }, align 8
35
+ @id_marray2 = dso_local global %class.specialization_id.5 { %struct.MArrayConst2 { [3 x i32 ] [i32 1 , i32 2 , i32 3 ] } }, align 8
36
+ @id_marray3 = dso_local global %class.specialization_id.6 { %struct.MArrayConst3 { [3 x i64 ] [i64 1 , i64 2 , i64 3 ] } }, align 8
37
+ @id_marray4 = dso_local global %class.specialization_id.7 { %struct.MArrayConst4 { [2 x [2 x [3 x i32 ]]] [[2 x [3 x i32 ]] [[3 x i32 ] [i32 1 , i32 2 , i32 3 ], [3 x i32 ] [i32 1 , i32 2 , i32 3 ]], [2 x [3 x i32 ]] [[3 x i32 ] [i32 1 , i32 2 , i32 3 ], [3 x i32 ] [i32 1 , i32 2 , i32 3 ]]] } }, align 8
22
38
23
39
; check that the following globals are preserved: even though they are won't be
24
40
; used in the module anymore, they could still be referenced by debug info
33
49
@__builtin_unique_stable_name._Z27get_specialization_constantIL_Z6id_intE17specialization_idIiEiET1_v = private unnamed_addr constant [34 x i8 ] c "_ZTS14name_generatorIL_Z6id_intEE\00 " , align 1
34
50
@__builtin_unique_stable_name._Z27get_specialization_constantIL_Z9id_composE17specialization_idI11ComposConstES1_ET1_v = private unnamed_addr constant [37 x i8 ] c "_ZTS14name_generatorIL_Z9id_composEE\00 " , align 1
35
51
@__builtin_unique_stable_name._Z27get_specialization_constantIL_Z10id_compos2E17specialization_idI12ComposConst2ES1_ET1_v = private unnamed_addr constant [39 x i8 ] c "_ZTS14name_generatorIL_Z10id_compos2EE\00 " , align 1
52
+ @__builtin_unique_stable_name._Z27get_specialization_constantIL_Z10id_vectorE17specialization_idI11VectorConstES1_ET1_v = private unnamed_addr constant [38 x i8 ] c "_ZTS14name_generatorIL_Z10id_vectorEE\00 " , align 1
53
+ @__builtin_unique_stable_name._Z27get_specialization_constantIL_Z10id_marrayE17specialization_idI11MArrayConstES1_ET1_v = private unnamed_addr constant [38 x i8 ] c "_ZTS14name_generatorIL_Z10id_marrayEE\00 " , align 1
54
+ @__builtin_unique_stable_name.id_marray2 = private unnamed_addr constant [39 x i8 ] c "_ZTS14name_generatorIL_Z10id_marray2EE\00 " , align 1
55
+ @__builtin_unique_stable_name.id_marray3 = private unnamed_addr constant [39 x i8 ] c "_ZTS14name_generatorIL_Z10id_marray3EE\00 " , align 1
56
+ @__builtin_unique_stable_name.id_marray4 = private unnamed_addr constant [39 x i8 ] c "_ZTS14name_generatorIL_Z10id_marray4EE\00 " , align 1
36
57
37
58
; CHECK-LABEL: define dso_local void @_Z4testv
38
59
define dso_local void @_Z4testv () local_unnamed_addr #0 {
77
98
; CHECK-RT: %[[#SE2:]] = call double @_Z20__spirv_SpecConstantid(i32 [[#SCID3:]], double 2.000000e+00)
78
99
; CHECK-RT: %[[#SE3:]] = call i32 @_Z20__spirv_SpecConstantii(i32 [[#SCID4:]], i32 13)
79
100
; CHECK-RT: %[[#SE4:]] = call float @_Z20__spirv_SpecConstantif(i32 [[#SCID5:]], float 0x4020666660000000)
80
- ; CHECK-RT: %[[#CE1:]] = call %struct.myConst @_Z29__spirv_SpecConstantCompositeif (i32 %[[#SE3]], float %[[#SE4]])
81
- ; CHECK-RT: %[[C1:[0-9a-z]+]] = call %struct.ComposConst @_Z29__spirv_SpecConstantCompositeidstruct.myConst (i32 %[[#SE1]], double %[[#SE2]], %struct.myConst %[[#CE1]])
101
+ ; CHECK-RT: %[[#CE1:]] = call %struct.myConst @_Z29__spirv_SpecConstantCompositeif_Rstruct.myConst (i32 %[[#SE3]], float %[[#SE4]])
102
+ ; CHECK-RT: %[[C1:[0-9a-z]+]] = call %struct.ComposConst @_Z29__spirv_SpecConstantCompositeidstruct.myConst_Rstruct.ComposConst (i32 %[[#SE1]], double %[[#SE2]], %struct.myConst %[[#CE1]])
82
103
;
83
104
; CHECK: store %struct.ComposConst %[[C1]], %struct.ComposConst*
84
105
@@ -93,9 +114,9 @@ entry:
93
114
; CHECK-RT: %[[#SE1:]] = call i8 @_Z20__spirv_SpecConstantia(i32 [[#SCID6:]], i8 1)
94
115
; CHECK-RT: %[[#SE2:]] = call i32 @_Z20__spirv_SpecConstantii(i32 [[#SCID7:]], i32 52)
95
116
; CHECK-RT: %[[#SE3:]] = call float @_Z20__spirv_SpecConstantif(i32 [[#SCID8:]], float 0x40479999A0000000)
96
- ; CHECK-RT: %[[#CE1:]] = call %struct.myConst @_Z29__spirv_SpecConstantCompositeif (i32 %[[#SE2]], float %[[#SE3]])
117
+ ; CHECK-RT: %[[#CE1:]] = call %struct.myConst @_Z29__spirv_SpecConstantCompositeif_Rstruct.myConst (i32 %[[#SE2]], float %[[#SE3]])
97
118
; CHECK-RT: %[[#SE4:]] = call double @_Z20__spirv_SpecConstantid(i32 [[#SCID9:]], double 2.000000e+00)
98
- ; CHECK-RT: %[[C2:[0-9a-z]+]] = call %struct.ComposConst2 @_Z29__spirv_SpecConstantCompositeastruct.myConstd (i8 %[[#SE1]], %struct.myConst %[[#CE1]], double %[[#SE4]])
119
+ ; CHECK-RT: %[[C2:[0-9a-z]+]] = call %struct.ComposConst2 @_Z29__spirv_SpecConstantCompositeastruct.myConstd_Rstruct.ComposConst2 (i8 %[[#SE1]], %struct.myConst %[[#CE1]], double %[[#SE4]])
99
120
;
100
121
; CHECK: store %struct.ComposConst2 %[[C2]], %struct.ComposConst2*
101
122
@@ -110,13 +131,53 @@ entry:
110
131
; CHECK-RT: %[[#SE2:]] = call double @_Z20__spirv_SpecConstantid(i32 [[#SCID3]], double 2.000000e+00)
111
132
; CHECK-RT: %[[#SE3:]] = call i32 @_Z20__spirv_SpecConstantii(i32 [[#SCID4]], i32 13)
112
133
; CHECK-RT: %[[#SE4:]] = call float @_Z20__spirv_SpecConstantif(i32 [[#SCID5]], float 0x4020666660000000)
113
- ; CHECK-RT: %[[#CE1:]] = call %struct.myConst @_Z29__spirv_SpecConstantCompositeif (i32 %[[#SE3]], float %[[#SE4]])
114
- ; CHECK-RT: %[[C3:[0-9a-z]+]] = call %struct.ComposConst @_Z29__spirv_SpecConstantCompositeidstruct.myConst (i32 %[[#SE1]], double %[[#SE2]], %struct.myConst %[[#CE1]])
134
+ ; CHECK-RT: %[[#CE1:]] = call %struct.myConst @_Z29__spirv_SpecConstantCompositeif_Rstruct.myConst (i32 %[[#SE3]], float %[[#SE4]])
135
+ ; CHECK-RT: %[[C3:[0-9a-z]+]] = call %struct.ComposConst @_Z29__spirv_SpecConstantCompositeidstruct.myConst_Rstruct.ComposConst (i32 %[[#SE1]], double %[[#SE2]], %struct.myConst %[[#CE1]])
115
136
;
116
137
; CHECK: store %struct.ComposConst %[[C3]], %struct.ComposConst*
117
138
call void @llvm.lifetime.end.p0i8 (i64 24 , i8* nonnull %2 ) #3
118
139
ret void
119
140
}
141
+
142
+ define void @test3 () {
143
+ %tmp = alloca %struct.VectorConst , align 8
144
+ %tmp1 = alloca %struct.MArrayConst , align 8
145
+ %tmp2 = alloca %struct.MArrayConst2 , align 8
146
+ %tmp3 = alloca %struct.MArrayConst3 , align 8
147
+ %tmp4 = alloca %struct.MArrayConst4 , align 8
148
+ %1 = bitcast %struct.VectorConst* %tmp to i8*
149
+ ; CHECK-DEF: %[[GEP1:[0-9a-z]+]] = getelementptr i8, i8* null, i32 54
150
+ ; CHECK-DEF: %[[BITCAST1:[0-9a-z]+]] = bitcast i8* %[[GEP1]] to %struct.VectorConst*
151
+ ; CHECK-DEF: %[[C1:[0-9a-z]+]] = load %struct.VectorConst, %struct.VectorConst* %[[BITCAST1]], align 8
152
+ ;
153
+ ; CHECK-RT: %[[#SE1:]] = call i32 @_Z20__spirv_SpecConstantii(i32 [[#SCID10:]], i32 1)
154
+ ; CHECK-RT: %[[#SE2:]] = call i32 @_Z20__spirv_SpecConstantii(i32 [[#SCID11:]], i32 2)
155
+ ; CHECK-RT: %[[#CE1:]] = call <2 x i32> @_Z29__spirv_SpecConstantCompositeii_RDv2_i(i32 %[[#SE1]], i32 %[[#SE2]])
156
+ ; CHECK-RT: call %struct.VectorConst @_Z29__spirv_SpecConstantCompositeDv2_i_Rstruct.VectorConst(<2 x i32> %[[#CE1]])
157
+ call void @_Z40__sycl_getComposite2020SpecConstantValueI11VectorConstET_PKcPvS4_ (%struct.VectorConst* nonnull sret (%struct.VectorConst ) align 8 %tmp , i8* getelementptr inbounds ([38 x i8 ], [38 x i8 ]* @__builtin_unique_stable_name._Z27get_specialization_constantIL_Z10id_vectorE17specialization_idI11VectorConstES1_ET1_v , i64 0 , i64 0 ), i8* bitcast (%class.specialization_id.3* @id_vector to i8* ), i8* null )
158
+ %2 = bitcast %struct.MArrayConst* %tmp1 to i8*
159
+ ; CHECK-DEF: %[[GEP2:[0-9a-z]+]] = getelementptr i8, i8* null, i32 62
160
+ ; CHECK-DEF: %[[BITCAST2:[0-9a-z]+]] = bitcast i8* %[[GEP2]] to %struct.MArrayConst*
161
+ ; CHECK-DEF: %[[C2:[0-9a-z]+]] = load %struct.MArrayConst, %struct.MArrayConst* %[[BITCAST2]], align 4
162
+ ;
163
+ ; CHECK-RT: %[[#SE1:]] = call i32 @_Z20__spirv_SpecConstantii(i32 [[#SCID12:]], i32 1)
164
+ ; CHECK-RT: %[[#SE2:]] = call i32 @_Z20__spirv_SpecConstantii(i32 [[#SCID13:]], i32 2)
165
+ ; CHECK-RT: %[[#CE1:]] = call [2 x i32] @_Z29__spirv_SpecConstantCompositeii_RA2_i(i32 %[[#SE1]], i32 %[[#SE2]])
166
+ ; CHECK-RT: call %struct.MArrayConst @_Z29__spirv_SpecConstantCompositeA2_i_Rstruct.MArrayConst([2 x i32] %[[#CE1]])
167
+ call void @_Z40__sycl_getComposite2020SpecConstantValueI11MArrayConstET_PKcPvS4_ (%struct.MArrayConst* nonnull sret (%struct.MArrayConst ) align 8 %tmp1 , i8* getelementptr inbounds ([38 x i8 ], [38 x i8 ]* @__builtin_unique_stable_name._Z27get_specialization_constantIL_Z10id_marrayE17specialization_idI11MArrayConstES1_ET1_v , i64 0 , i64 0 ), i8* bitcast (%class.specialization_id.4* @id_marray to i8* ), i8* null )
168
+ ; Here we only check the mangling of generated __spirv_SpecConstantComposite function
169
+ %3 = bitcast %struct.MArrayConst2* %tmp2 to i8*
170
+ ; CHECK-RT: call %struct.MArrayConst2 @_Z29__spirv_SpecConstantCompositeA3_i_Rstruct.MArrayConst2
171
+ call void @_Z40__sycl_getComposite2020SpecConstantValueI11MArrayConst2ET_PKcPvS4_ (%struct.MArrayConst2* nonnull sret (%struct.MArrayConst2 ) align 8 %tmp2 , i8* getelementptr inbounds ([39 x i8 ], [39 x i8 ]* @__builtin_unique_stable_name.id_marray2 , i64 0 , i64 0 ), i8* bitcast (%class.specialization_id.5* @id_marray2 to i8* ), i8* null )
172
+ %4 = bitcast %struct.MArrayConst3* %tmp3 to i8*
173
+ ; CHECK-RT: call %struct.MArrayConst3 @_Z29__spirv_SpecConstantCompositeA3_x_Rstruct.MArrayConst3
174
+ call void @_Z40__sycl_getComposite2020SpecConstantValueI11MArrayConst3ET_PKcPvS4_ (%struct.MArrayConst3* nonnull sret (%struct.MArrayConst3 ) align 8 %tmp3 , i8* getelementptr inbounds ([39 x i8 ], [39 x i8 ]* @__builtin_unique_stable_name.id_marray3 , i64 0 , i64 0 ), i8* bitcast (%class.specialization_id.6* @id_marray3 to i8* ), i8* null )
175
+ %5 = bitcast %struct.MArrayConst4* %tmp4 to i8*
176
+ ; CHECK-RT: call %struct.MArrayConst4 @_Z29__spirv_SpecConstantCompositeA2_A2_A3_i_Rstruct.MArrayConst4
177
+ call void @_Z40__sycl_getComposite2020SpecConstantValueI11MArrayConst4ET_PKcPvS4_ (%struct.MArrayConst4* nonnull sret (%struct.MArrayConst4 ) align 8 %tmp4 , i8* getelementptr inbounds ([39 x i8 ], [39 x i8 ]* @__builtin_unique_stable_name.id_marray4 , i64 0 , i64 0 ), i8* bitcast (%class.specialization_id.7* @id_marray4 to i8* ), i8* null )
178
+ ret void
179
+ }
180
+
120
181
declare void @llvm.lifetime.start.p0i8 (i64 immarg, i8* nocapture ) #1
121
182
122
183
declare void @llvm.lifetime.end.p0i8 (i64 immarg, i8* nocapture ) #1
@@ -131,14 +192,24 @@ declare dso_local void @_Z40__sycl_getComposite2020SpecConstantValueI11ComposCon
131
192
132
193
declare dso_local void @_Z40__sycl_getComposite2020SpecConstantValueI12ComposConst2ET_PKcPvS4_ (%struct.ComposConst2* sret (%struct.ComposConst2 ) align 8 , i8* , i8* , i8* ) local_unnamed_addr #2
133
194
195
+ declare dso_local void @_Z40__sycl_getComposite2020SpecConstantValueI11VectorConstET_PKcPvS4_ (%struct.VectorConst* sret (%struct.VectorConst ) align 8 , i8* , i8* , i8* ) local_unnamed_addr #2
196
+
197
+ declare dso_local void @_Z40__sycl_getComposite2020SpecConstantValueI11MArrayConstET_PKcPvS4_ (%struct.MArrayConst* sret (%struct.MArrayConst ) align 8 , i8* , i8* , i8* ) local_unnamed_addr #2
198
+
199
+ declare dso_local void @_Z40__sycl_getComposite2020SpecConstantValueI11MArrayConst2ET_PKcPvS4_ (%struct.MArrayConst2* sret (%struct.MArrayConst2 ) align 8 , i8* , i8* , i8* ) local_unnamed_addr #2
200
+
201
+ declare dso_local void @_Z40__sycl_getComposite2020SpecConstantValueI11MArrayConst3ET_PKcPvS4_ (%struct.MArrayConst3* sret (%struct.MArrayConst3 ) align 8 , i8* , i8* , i8* ) local_unnamed_addr #2
202
+
203
+ declare dso_local void @_Z40__sycl_getComposite2020SpecConstantValueI11MArrayConst4ET_PKcPvS4_ (%struct.MArrayConst4* sret (%struct.MArrayConst4 ) align 8 , i8* , i8* , i8* ) local_unnamed_addr #2
204
+
134
205
attributes #0 = { uwtable mustprogress "denormal-fp-math" ="preserve-sign,preserve-sign" "denormal-fp-math-f32" ="ieee,ieee" "disable-tail-calls" ="false" "frame-pointer" ="none" "less-precise-fpmad" ="false" "min-legal-vector-width" ="0" "no-infs-fp-math" ="true" "no-jump-tables" ="false" "no-nans-fp-math" ="true" "no-signed-zeros-fp-math" ="true" "no-trapping-math" ="true" "stack-protector-buffer-size" ="8" "target-cpu" ="x86-64" "target-features" ="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu" ="generic" "unsafe-fp-math" ="true" "use-soft-float" ="false" }
135
206
attributes #1 = { argmemonly nofree nosync nounwind willreturn }
136
207
attributes #2 = { "denormal-fp-math" ="preserve-sign,preserve-sign" "denormal-fp-math-f32" ="ieee,ieee" "disable-tail-calls" ="false" "frame-pointer" ="none" "less-precise-fpmad" ="false" "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-cpu" ="x86-64" "target-features" ="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu" ="generic" "unsafe-fp-math" ="true" "use-soft-float" ="false" }
137
208
attributes #3 = { nounwind }
138
209
139
- ; CHECK: !sycl.specialization-constants = !{![[#ID0:]], ![[#ID1:]], ![[#ID2:]], ![[#ID3:]]}
210
+ ; CHECK: !sycl.specialization-constants = !{![[#ID0:]], ![[#ID1:]], ![[#ID2:]], ![[#ID3:]], ![[#ID4:]], ![[#ID5:]]
140
211
;
141
- ; CHECK-DEF: !sycl.specialization-constants-default-values = !{![[#ID4:]], ![[#ID5:]], ![[#ID6:]], ![[#ID7:]]}
212
+ ; CHECK-DEF: !sycl.specialization-constants-default-values = !{![[#ID4:]], ![[#ID5:]], ![[#ID6:]], ![[#ID7:]], ![[#ID8:]], ![[#ID9:]]
142
213
; CHECK-RT-NOT: !sycl.specialization-constants-default-values
143
214
;
144
215
; CHECK: ![[#ID0]] = !{!"_ZTS14name_generatorIL_Z9id_halfEE", i32 0, i32 0, i32 2}
@@ -162,3 +233,11 @@ attributes #3 = { nounwind }
162
233
; CHECK-DEF: ![[#ID5]] = !{i32 42}
163
234
; CHECK-DEF: ![[#ID6]] = !{%struct.ComposConst { i32 1, double 2.000000e+00, %struct.myConst { i32 13, float 0x4020666660000000 } }}
164
235
; CHECK-DEF: ![[#ID7]] = !{%struct.ComposConst2 { i8 1, %struct.myConst { i32 52, float 0x40479999A0000000 }, double 2.000000e+00 }}
236
+ ;
237
+ ; CHECK-DEF: ![[#ID8]] = !{%struct.VectorConst { <2 x i32> <i32 1, i32 2> }}
238
+ ; CHECK-DEF: ![[#ID9]] = !{%struct.MArrayConst { [2 x i32] [i32 1, i32 2] }}
239
+ ;
240
+ ; CHECK-RT: ![[#ID4]] = !{!"_ZTS14name_generatorIL_Z10id_vectorEE", i32 [[#SCID10]], i32 0, i32 4,
241
+ ; CHECK-RT-SAME: i32 [[#SCID11]], i32 4, i32 4}
242
+ ; CHECK-RT: ![[#ID5]] = !{!"_ZTS14name_generatorIL_Z10id_marrayEE", i32 [[#SCID12]], i32 0, i32 4,
243
+ ; CHECK-RT-SAME: i32 [[#SCID13]], i32 4, i32 4}
0 commit comments