File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
lib/SILOptimizer/SILCombiner Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -1520,8 +1520,14 @@ SILInstruction *SILCombiner::legacyVisitApplyInst(ApplyInst *AI) {
1520
1520
return nullptr ;
1521
1521
1522
1522
SILValue callee = AI->getCallee ();
1523
- if (auto *cee = dyn_cast<ConvertEscapeToNoEscapeInst>(callee)) {
1524
- callee = cee->getOperand ();
1523
+ for (;;) {
1524
+ if (auto *cee = dyn_cast<ConvertEscapeToNoEscapeInst>(callee)) {
1525
+ callee = cee->getOperand ();
1526
+ } else if (auto *mdi = dyn_cast<MarkDependenceInst>(callee)) {
1527
+ callee = mdi->getValue ();
1528
+ } else {
1529
+ break ;
1530
+ }
1525
1531
}
1526
1532
if (auto *CFI = dyn_cast<ConvertFunctionInst>(callee))
1527
1533
return optimizeApplyOfConvertFunctionInst (AI, CFI);
Original file line number Diff line number Diff line change @@ -1172,6 +1172,22 @@ bb0(%0 : $Int):
1172
1172
return %r : $()
1173
1173
}
1174
1174
1175
+ // CHECK-LABEL: sil [ossa] @test_mark_dependence_of_closure :
1176
+ // CHECK-NOT: partial_apply
1177
+ // CHECK-LABEL: } // end sil function 'test_mark_dependence_of_closure'
1178
+ sil [ossa] @test_mark_dependence_of_closure : $@convention(thin) (Int) -> () {
1179
+ bb0(%0 : $Int):
1180
+ %3 = function_ref @closure2 : $@convention(thin) (Int) -> ()
1181
+ %4 = partial_apply %3(%0) : $@convention(thin) (Int) -> ()
1182
+ %5 = convert_function %4 to $@callee_owned () -> ()
1183
+ %6 = convert_escape_to_noescape %5 to $@noescape @callee_owned () -> ()
1184
+ %7 = mark_dependence %6 on %5
1185
+ apply %7() : $@noescape @callee_owned () -> ()
1186
+ destroy_value %5
1187
+ %r = tuple ()
1188
+ return %r : $()
1189
+ }
1190
+
1175
1191
sil [ossa] @closure2 : $@convention(thin) (Int) -> ()
1176
1192
1177
1193
sil [ossa] @yield1 : $@yield_once(Float) -> (@yields Float) {
You can’t perform that action at this time.
0 commit comments