@@ -95,6 +95,8 @@ class DestroyHoisting {
95
95
96
96
void getUsedLocationsOfAddr (Bits &bits, SILValue addr);
97
97
98
+ void getUsedLocationsOfOperands (Bits &bits, SILInstruction *I);
99
+
98
100
void getUsedLocationsOfInst (Bits &bits, SILInstruction *Inst);
99
101
100
102
void moveDestroys (MemoryDataflow &dataFlow);
@@ -308,6 +310,12 @@ void DestroyHoisting::getUsedLocationsOfAddr(Bits &bits, SILValue addr) {
308
310
}
309
311
}
310
312
313
+ void DestroyHoisting::getUsedLocationsOfOperands (Bits &bits, SILInstruction *I) {
314
+ for (Operand &op : I->getAllOperands ()) {
315
+ getUsedLocationsOfAddr (bits, op.get ());
316
+ }
317
+ }
318
+
311
319
// Set all bits of locations which instruction \p I is using. It's including
312
320
// parent and sub-locations (see comment in getUsedLocationsOfAddr).
313
321
void DestroyHoisting::getUsedLocationsOfInst (Bits &bits, SILInstruction *I) {
@@ -319,18 +327,20 @@ void DestroyHoisting::getUsedLocationsOfInst(Bits &bits, SILInstruction *I) {
319
327
}
320
328
break ;
321
329
case SILInstructionKind::EndApplyInst:
322
- // Operands passed to begin_apply are alive throughout the end_apply.
323
- I = cast<EndApplyInst>(I)->getBeginApply ();
324
- LLVM_FALLTHROUGH;
330
+ // Operands passed to begin_apply are alive throughout an end_apply ...
331
+ getUsedLocationsOfOperands (bits, cast<EndApplyInst>(I)->getBeginApply ());
332
+ break ;
333
+ case SILInstructionKind::AbortApplyInst:
334
+ // ... or abort_apply.
335
+ getUsedLocationsOfOperands (bits, cast<AbortApplyInst>(I)->getBeginApply ());
336
+ break ;
325
337
case SILInstructionKind::LoadInst:
326
338
case SILInstructionKind::StoreInst:
327
339
case SILInstructionKind::CopyAddrInst:
328
340
case SILInstructionKind::ApplyInst:
329
341
case SILInstructionKind::TryApplyInst:
330
342
case SILInstructionKind::YieldInst:
331
- for (Operand &op : I->getAllOperands ()) {
332
- getUsedLocationsOfAddr (bits, op.get ());
333
- }
343
+ getUsedLocationsOfOperands (bits, I);
334
344
break ;
335
345
case SILInstructionKind::DebugValueAddrInst:
336
346
case SILInstructionKind::DestroyAddrInst:
0 commit comments