@@ -22,6 +22,15 @@ import pre_specialized_module_layouts
22
22
@inline ( never)
23
23
public func consume< T> ( _ x: T ) { }
24
24
25
+ public struct ReferenceWrapperStruct {
26
+ let x : AnyObject
27
+ }
28
+
29
+ @_alignment ( 16 )
30
+ public struct OveralignedReferenceWrapperStruct {
31
+ let x : AnyObject
32
+ }
33
+
25
34
// Make sure we generate the public pre-specialized entry points.
26
35
27
36
// OPT-DAG: sil @$s22pre_specialize_layouts10testPublic1tyx_tlFSf_Ts5 : $@convention(thin) (Float) -> () {
@@ -63,7 +72,8 @@ internal func testEmitIntoClient<T>(t: T) {
63
72
print ( t)
64
73
}
65
74
66
- // OPT: sil @$s22pre_specialize_layouts28usePrespecializedEntryPointsyyF : $@convention(thin) () -> () {
75
+ // OPT: sil @$s22pre_specialize_layouts28usePrespecializedEntryPoints13wrapperStruct11overalignedyAA016ReferenceWrapperI0V_AA011OveralignedklI0VtF : $@convention(thin) (@guaranteed ReferenceWrapperStruct, @guaranteed OveralignedReferenceWrapperStruct) -> () {
76
+ // OPT: bb0([[P1:%.*]] : $ReferenceWrapperStruct, [[P2:%.*]] : $OveralignedReferenceWrapperStruct):
67
77
// OPT: [[F1:%.*]] = function_ref @$s30pre_specialized_module_layouts20publicPrespecializedyyxlFSi_Ts5 : $@convention(thin) (Int) -> ()
68
78
// OPT: apply [[F1]]
69
79
// OPT: [[F2:%.*]] = function_ref @$s30pre_specialized_module_layouts20publicPrespecializedyyxlFSd_Ts5 : $@convention(thin) (Double) -> ()
@@ -73,13 +83,17 @@ internal func testEmitIntoClient<T>(t: T) {
73
83
// OPT: [[F7:%.*]] = function_ref @$s30pre_specialized_module_layouts20publicPrespecializedyyxlFyXl_Ts5 : $@convention(thin) (@guaranteed AnyObject) -> ()
74
84
// OPT: [[A1:%.*]] = unchecked_ref_cast {{%.*}} : $SomeClass to $AnyObject
75
85
// OPT: apply [[F7]]([[A1]]) : $@convention(thin) (@guaranteed AnyObject) -> ()
86
+ // OPT: [[A2:%.*]] = unchecked_bitwise_cast [[P1]] : $ReferenceWrapperStruct to $AnyObject
87
+ // OPT: apply [[F7]]([[A2]]) : $@convention(thin) (@guaranteed AnyObject) -> ()
88
+ // OPT: [[A3:%.*]] = alloc_stack $OveralignedReferenceWrapperStruct
89
+ // OPT: apply {{%.*}}<OveralignedReferenceWrapperStruct>([[A3]])
76
90
// OPT: [[F3:%.*]] = function_ref @$s30pre_specialized_module_layouts36internalEmitIntoClientPrespecializedyyxlFSi_Ts5 : $@convention(thin) (Int) -> ()
77
91
// OPT: apply [[F3]]
78
92
// OPT: [[F4:%.*]] = function_ref @$s30pre_specialized_module_layouts36internalEmitIntoClientPrespecializedyyxlFSd_Ts5 : $@convention(thin) (Double) -> ()
79
93
// OPT: apply [[F4]]
80
94
// OPT: [[F5:%.*]] = function_ref @$s30pre_specialized_module_layouts16useInternalThingyyxlFSi_Tg5
81
95
// OPT: apply [[F5]]({{.*}}) : $@convention(thin) (Int) -> ()
82
- // OPT: } // end sil function '$s22pre_specialize_layouts28usePrespecializedEntryPointsyyF '
96
+ // OPT: } // end sil function '$s22pre_specialize_layouts28usePrespecializedEntryPoints13wrapperStruct11overalignedyAA016ReferenceWrapperI0V_AA011OveralignedklI0VtF '
83
97
84
98
// OPT: sil {{.*}} @$s30pre_specialized_module_layouts16useInternalThingyyxlFSi_Tg5 : $@convention(thin) (Int) -> () {
85
99
// OPT: [[F1:%.*]] = function_ref @$s30pre_specialized_module_layouts14InternalThing2V7computexyFSi_Ts5 : $@convention(method) (InternalThing2<Int>) -> Int
@@ -124,11 +138,14 @@ internal func testEmitIntoClient<T>(t: T) {
124
138
// OPT: [[R10:%.*]] = unchecked_addr_cast [[R9]] : $*AnyObject to $*SomeClass
125
139
// OPT: } // end sil function '$s30pre_specialized_module_layouts16useInternalThingyyxlFAA9SomeClassC_Tg5'
126
140
127
- public func usePrespecializedEntryPoints( ) {
141
+ public func usePrespecializedEntryPoints( wrapperStruct : ReferenceWrapperStruct , overaligned : OveralignedReferenceWrapperStruct ) {
128
142
publicPrespecialized ( 1 )
129
143
publicPrespecialized ( 1.0 )
130
144
publicPrespecialized ( SomeData ( ) )
131
145
publicPrespecialized ( SomeClass ( ) )
146
+ publicPrespecialized ( wrapperStruct)
147
+ // should not apply _Class specialization for overaligned struct
148
+ publicPrespecialized ( overaligned)
132
149
useInternalEmitIntoClientPrespecialized ( 2 )
133
150
useInternalEmitIntoClientPrespecialized ( 2.0 )
134
151
useInternalThing ( 2 )
0 commit comments