Skip to content

Commit 3cc0d36

Browse files
committed
Mandatory Inlining: Look through convert_function recursively
1 parent e465a10 commit 3cc0d36

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/SILOptimizer/Mandatory/MandatoryInlining.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ static SILValue stripFunctionConversions(SILValue CalleeValue) {
632632
// If the conversion only changes the substitution level of the function,
633633
// we can also look through it.
634634
if (ConvertFn->onlyConvertsSubstitutions())
635-
return stripCopiesAndBorrows(ConvertFn->getOperand());
635+
return stripFunctionConversions(ConvertFn->getOperand());
636636

637637
auto FromCalleeTy =
638638
ConvertFn->getOperand()->getType().castTo<SILFunctionType>();
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: %target-swift-frontend -emit-sil %s | %FileCheck %s
2+
3+
@_transparent func takesGenericAutoclosure<T>(_ fn: @autoclosure () -> T) {
4+
_ = fn()
5+
}
6+
7+
// CHECK-LABEL: sil hidden @$s38mandatory_inlining_generic_autoclosure23callsGenericAutoclosureyyxlF : $@convention(thin) <T> (@in_guaranteed T) -> () {
8+
// CHECK-NOT: function_ref @$s38mandatory_inlining_generic_autoclosure23callsGenericAutoclosureyyxlFxyXEfu_
9+
10+
func callsGenericAutoclosure<T>(_ t: T) {
11+
takesGenericAutoclosure(t)
12+
}

0 commit comments

Comments
 (0)