File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -2292,6 +2292,15 @@ void swift::trySpecializeApplyOfGeneric(
2292
2292
if (shouldNotSpecialize (RefF, F))
2293
2293
return ;
2294
2294
2295
+ // If our callee has ownership, do not specialize for now. This should only
2296
+ // occur with transparent referenced functions.
2297
+ //
2298
+ // FIXME: Support this.
2299
+ if (RefF->hasOwnership ()) {
2300
+ assert (RefF->isTransparent ());
2301
+ return ;
2302
+ }
2303
+
2295
2304
// If the caller and callee are both fragile, preserve the fragility when
2296
2305
// cloning the callee. Otherwise, strip it off so that we can optimize
2297
2306
// the body more.
Original file line number Diff line number Diff line change
1
+ // RUN: %target-sil-opt -enable-sil-verify-all -generic-specializer %/s | %FileCheck %s
2
+
3
+ sil_stage canonical
4
+
5
+ import Builtin
6
+ import Swift
7
+
8
+ sil [ossa] [transparent] @ossaTransparentCallee : $@convention(thin) <T> (@in T) -> () {
9
+ bb0(%0 : $*T):
10
+ destroy_addr %0 : $*T
11
+ %9999 = tuple()
12
+ return %9999 : $()
13
+ }
14
+
15
+ // CHECK-LABEL: sil @caller : $@convention(thin) (@owned Builtin.NativeObject) -> () {
16
+ // CHECK: [[FUNC:%.*]] = function_ref @ossaTransparentCallee : $@convention(thin) <τ_0_0> (@in τ_0_0) -> ()
17
+ // CHECK: apply [[FUNC]]<Builtin.NativeObject>(
18
+ // CHECK: } // end sil function 'caller'
19
+ sil @caller : $@convention(thin) (@owned Builtin.NativeObject) -> () {
20
+ bb0(%0 : $Builtin.NativeObject):
21
+ %1 = function_ref @ossaTransparentCallee : $@convention(thin) <τ_0_0> (@in τ_0_0) -> ()
22
+ %2 = alloc_stack $Builtin.NativeObject
23
+ store %0 to %2 : $*Builtin.NativeObject
24
+ apply %1<Builtin.NativeObject>(%2) : $@convention(thin) <τ_0_0> (@in τ_0_0) -> ()
25
+ dealloc_stack %2 : $*Builtin.NativeObject
26
+ %9999 = tuple()
27
+ return %9999 : $()
28
+ }
You can’t perform that action at this time.
0 commit comments