Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/SILOptimizer/Utils/PerformanceInlinerUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ SILValue swift::stripFunctionConversions(SILValue val) {
val = cvt->getOperand();
result = val;
continue;
} else if (auto md = dyn_cast<MarkDependenceInst>(val)) {
val = md->getValue();
result = val;
} else {
break;
}
Expand Down
15 changes: 10 additions & 5 deletions test/SILOptimizer/inline_heuristics.sil
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,27 @@ enum E {
case B((Int32) -> Int32)
}

class C {
init()
}

// CHECK-LABEL: sil @testDirectClosure
// CHECK: [[C:%[0-9]+]] = thin_to_thick_function
// CHECK: apply [[C]](
// CHECK: [[MD:%[0-9]+]] = mark_dependence [[C]]
// CHECK: apply [[MD]](
// CHECK: return

// CHECK-LOG-LABEL: Inline into caller: testDirectClosure
// CHECK-LOG-NEXT: decision {{.*}}, b=70,

sil @testDirectClosure : $@convention(thin) () -> Int32 {
bb0:
sil @testDirectClosure : $@convention(thin) (@guaranteed C) -> Int32 {
bb0(%c : $C):
%0 = function_ref @takeDirectClosure : $@convention(thin) (@owned @callee_guaranteed (Int32) -> Int32) -> Int32
%1 = function_ref @closure : $@convention(thin) (Int32) -> Int32
%2 = thin_to_thick_function %1 : $@convention(thin) (Int32) -> Int32 to $@callee_guaranteed (Int32) -> Int32
%3 = apply %0(%2) : $@convention(thin) (@owned @callee_guaranteed (Int32) -> Int32) -> Int32
return %3 : $Int32
%3 = mark_dependence %2 on %c
%4 = apply %0(%3) : $@convention(thin) (@owned @callee_guaranteed (Int32) -> Int32) -> Int32
return %4 : $Int32
}

sil @takeDirectClosure : $@convention(thin) (@owned @callee_guaranteed (Int32) -> Int32) -> Int32 {
Expand Down