@@ -187,32 +187,15 @@ static bool hasExpectedUsesOfNoEscapePartialApply(Operand *partialApplyUse) {
187
187
return partialApplyUse->getOperandNumber () ==
188
188
CopyBlockWithoutEscapingInst::Closure;
189
189
190
- // A copy_value that is only used by the store to a block storage is fine.
191
- // It is part of the pattern we emit for verifying that a noescape closure
192
- // passed to objc has not escaped.
193
- // %4 = convert_escape_to_noescape [not_guaranteed] %3 :
194
- // $@callee_guaranteed () -> () to $@noescape @callee_guaranteed () -> ()
195
- // %5 = function_ref @withoutEscapingThunk
196
- // %6 = partial_apply [callee_guaranteed] %5(%4) :
197
- // $@convention(thin) (@noescape @callee_guaranteed () -> ()) -> ()
198
- // %7 = mark_dependence %6 : $@callee_guaranteed () -> () on %4 :
199
- // $@noescape @callee_guaranteed () -> ()
200
- // %8 = copy_value %7 : $@callee_guaranteed () -> ()
201
- // %9 = alloc_stack $@block_storage @callee_guaranteed () -> ()
202
- // %10 = project_block_storage %9 :
203
- // $*@block_storage @callee_guaranteed () -> ()
204
- // store %8 to [init] %10 : $*@callee_guaranteed () -> ()
205
- // %13 = init_block_storage_header %9 :
206
- // $*@block_storage @callee_guaranteed () -> (),
207
- // invoke %12
208
- // %14 = copy_block_without_escaping %13 : $() -> () withoutEscaping %7
209
190
case SILInstructionKind::CopyValueInst:
210
- return isa<StoreInst>(getSingleNonDebugUser (cast<CopyValueInst>(user)));
191
+ return llvm::all_of (cast<CopyValueInst>(user)->getUses (),
192
+ hasExpectedUsesOfNoEscapePartialApply);
211
193
212
194
// End borrow is always ok.
213
195
case SILInstructionKind::EndBorrowInst:
214
196
return true ;
215
197
198
+ case SILInstructionKind::IsEscapingClosureInst:
216
199
case SILInstructionKind::StoreInst:
217
200
case SILInstructionKind::DestroyValueInst:
218
201
// @block_storage is passed by storing it to the stack. We know this is
0 commit comments