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) {
227
227
for (auto use : source->getUses ()) {
228
228
auto user = use->getUser ();
229
229
230
+ if (auto BBI = dyn_cast<BeginBorrowInst>(user)) {
231
+ analyzeUsesOfBox (BBI);
232
+ continue ;
233
+ }
234
+
230
235
if (auto MUI = dyn_cast<MarkUninitializedInst>(user)) {
231
236
analyzeUsesOfBox (MUI);
232
237
continue ;
@@ -238,10 +243,9 @@ void SelectEnforcement::analyzeUsesOfBox(SingleValueInstruction *source) {
238
243
}
239
244
240
245
// 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))
245
249
continue ;
246
250
247
251
// Treat everything else as an escape.
@@ -667,6 +671,8 @@ void AccessEnforcementSelection::processFunction(SILFunction *F) {
667
671
SourceAccess
668
672
AccessEnforcementSelection::getAccessKindForBox (ProjectBoxInst *projection) {
669
673
SILValue source = projection->getOperand ();
674
+ if (auto *BBI = dyn_cast<BeginBorrowInst>(source))
675
+ source = BBI->getOperand ();
670
676
if (auto *MUI = dyn_cast<MarkUninitializedInst>(source))
671
677
source = MUI->getOperand ();
672
678
You can’t perform that action at this time.
0 commit comments