File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
lib/SILOptimizer/Mandatory Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,11 @@ void SelectEnforcement::analyzeUsesOfBox(SingleValueInstruction *source) {
227227 for (auto use : source->getUses ()) {
228228 auto user = use->getUser ();
229229
230+ if (auto BBI = dyn_cast<BeginBorrowInst>(user)) {
231+ analyzeUsesOfBox (BBI);
232+ continue ;
233+ }
234+
230235 if (auto MUI = dyn_cast<MarkUninitializedInst>(user)) {
231236 analyzeUsesOfBox (MUI);
232237 continue ;
@@ -238,10 +243,9 @@ void SelectEnforcement::analyzeUsesOfBox(SingleValueInstruction *source) {
238243 }
239244
240245 // Ignore certain other uses that do not capture the value.
241- if (isa<StrongRetainInst>(user) ||
242- isa<StrongReleaseInst>(user) ||
243- isa<DestroyValueInst>(user) ||
244- isa<DeallocBoxInst>(user))
246+ if (isa<StrongRetainInst>(user) || isa<StrongReleaseInst>(user) ||
247+ isa<DestroyValueInst>(user) || isa<DeallocBoxInst>(user) ||
248+ isa<EndBorrowInst>(user))
245249 continue ;
246250
247251 // Treat everything else as an escape.
@@ -667,6 +671,8 @@ void AccessEnforcementSelection::processFunction(SILFunction *F) {
667671SourceAccess
668672AccessEnforcementSelection::getAccessKindForBox (ProjectBoxInst *projection) {
669673 SILValue source = projection->getOperand ();
674+ if (auto *BBI = dyn_cast<BeginBorrowInst>(source))
675+ source = BBI->getOperand ();
670676 if (auto *MUI = dyn_cast<MarkUninitializedInst>(source))
671677 source = MUI->getOperand ();
672678
You can’t perform that action at this time.
0 commit comments