Skip to content

Commit 01c6d4b

Browse files
committed
Add a test case for recent change in FunctionSignatureOpts
1 parent 5bfb9b2 commit 01c6d4b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/SILOptimizer/functionsigopts.sil

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,6 +1326,27 @@ bb0(%0 : $Optional<(foo, foo)>):
13261326
}
13271327

13281328

1329+
// Check if externally available functions are optimized.
1330+
1331+
sil public_external [noinline] @externally_available_with_dead_arg : $@convention(thin) (@guaranteed foo) -> () {
1332+
bb0(%0 : $foo):
1333+
%r = tuple()
1334+
return %r : $()
1335+
}
1336+
1337+
// CHECK-LABEL: sil @call_externally_available
1338+
// CHECK: [[F:%[0-9]+]] = function_ref @_TTSf4d__externally_available_with_dead_arg : $@convention(thin) () -> ()
1339+
// CHECK: apply [[F]]()
1340+
// CHECK: return
1341+
sil @call_externally_available : $@convention(thin) (@guaranteed foo) -> () {
1342+
bb0(%0 : $foo):
1343+
%f = function_ref @externally_available_with_dead_arg : $@convention(thin) (@guaranteed foo) -> ()
1344+
%a = apply %f(%0) : $@convention(thin) (@guaranteed foo) -> ()
1345+
%r = tuple()
1346+
return %r : $()
1347+
}
1348+
1349+
13291350
// We should remove the array semantic from specialized calls.
13301351

13311352
// CHECK-LABEL: sil [fragile] [thunk] [always_inline] [_semantics "array.foobar"] @array_semantic : $@convention(method) (@owned Builtin.NativeObject) -> () {

0 commit comments

Comments
 (0)