Skip to content

Commit 88f1438

Browse files
committed
[OptHopToExecutor] Borrows don't need executors.
Although they currently have MemoryBehavior::MayHaveSideEffects, the begin_borrow and end_borrow instructions do not have side-effects of interest to this pass.
1 parent fc112a6 commit 88f1438

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/SILOptimizer/Mandatory/OptimizeHopToExecutor.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,14 @@ bool OptimizeHopToExecutor::needsExecutor(SILInstruction *inst) {
331331
if (auto *copy = dyn_cast<CopyAddrInst>(inst)) {
332332
return isGlobalMemory(copy->getSrc()) || isGlobalMemory(copy->getDest());
333333
}
334+
// BeginBorrowInst and EndBorrowInst currently have
335+
// MemoryBehavior::MayHaveSideEffects. Fixing that is tracked by
336+
// rdar://111875527. These instructions only have effects in the sense of
337+
// memory dependencies, which aren't relevant for hop_to_executor
338+
// elimination.
339+
if (isa<BeginBorrowInst>(inst) || isa<EndBorrowInst>(inst)) {
340+
return false;
341+
}
334342
return inst->mayReadOrWriteMemory();
335343
}
336344

0 commit comments

Comments
 (0)