Skip to content

Commit a3aed17

Browse files
committed
Disable inlining borrow accessors with return_borrow instruction
1 parent f179e5d commit a3aed17

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/SILOptimizer/Utils/SILInliner.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ bool SILInliner::canInlineApplySite(FullApplySite apply) {
7777
if (auto BA = dyn_cast<BeginApplyInst>(apply))
7878
return canInlineBeginApply(BA);
7979

80+
if (apply.hasGuaranteedResult()) {
81+
if (auto *callee = apply.getReferencedFunctionOrNull()) {
82+
auto returnBB = callee->findReturnBB();
83+
if (returnBB != callee->end() &&
84+
isa<ReturnBorrowInst>(returnBB->getTerminator())) {
85+
return false;
86+
}
87+
}
88+
}
8089
return true;
8190
}
8291

0 commit comments

Comments
 (0)