@@ -322,7 +322,7 @@ bool LoadBorrowNeverInvalidatedAnalysis::
322
322
// Treat None as a write.
323
323
if (!writes) {
324
324
llvm::errs () << " Failed to find cached writes for: " << *address;
325
- return false ;
325
+ return true ;
326
326
}
327
327
328
328
auto lbiProjPath =
@@ -351,13 +351,13 @@ bool LoadBorrowNeverInvalidatedAnalysis::
351
351
// our address from lbiProjPath. If not, we have to a
352
352
if (!lbiProjPath) {
353
353
llvm::errs () << " Couldn't find path root for load_borrow: " << *lbi;
354
- return false ;
354
+ return true ;
355
355
}
356
356
357
357
auto writePath = ProjectionPath::getProjectionPath (address, op->get ());
358
358
if (!writePath) {
359
359
llvm::errs () << " Couldn't find path root for write: " << *op->getUser ();
360
- return false ;
360
+ return true ;
361
361
}
362
362
363
363
// The symmetric difference of two projection paths consists of the parts of
@@ -368,11 +368,11 @@ bool LoadBorrowNeverInvalidatedAnalysis::
368
368
}
369
369
370
370
llvm::errs () << " Write: " << *op->getUser ();
371
- return false ;
371
+ return true ;
372
372
}
373
373
374
374
// Ok, we are good.
375
- return true ;
375
+ return false ;
376
376
}
377
377
378
378
// ===----------------------------------------------------------------------===//
@@ -450,8 +450,7 @@ bool LoadBorrowNeverInvalidatedAnalysis::
450
450
451
451
return false ;
452
452
}
453
-
454
- bool LoadBorrowNeverInvalidatedAnalysis::isNeverInvalidated (
453
+ bool LoadBorrowNeverInvalidatedAnalysis::isInvalidated (
455
454
LoadBorrowInst *lbi) {
456
455
457
456
// FIXME: To be reenabled separately in a follow-on commit.
@@ -470,7 +469,7 @@ bool LoadBorrowNeverInvalidatedAnalysis::isNeverInvalidated(
470
469
471
470
// If we have a let address, then we are already done.
472
471
if (storage.isLetAccess ()) {
473
- return true ;
472
+ return false ;
474
473
}
475
474
// At this point, we know that we /may/ have writes. Now we go through various
476
475
// cases to try and exhaustively identify if those writes overlap with our
@@ -484,7 +483,7 @@ bool LoadBorrowNeverInvalidatedAnalysis::isNeverInvalidated(
484
483
if (auto *bai = dyn_cast<BeginAccessInst>(address)) {
485
484
// We do not have a modify, assume we are correct.
486
485
if (bai->getAccessKind () != SILAccessKind::Modify) {
487
- return true ;
486
+ return false ;
488
487
}
489
488
490
489
// Otherwise, validate that any writes to our begin_access is not when the
@@ -533,12 +532,8 @@ bool LoadBorrowNeverInvalidatedAnalysis::isNeverInvalidated(
533
532
}
534
533
case AccessedStorage::Argument: {
535
534
auto *arg = cast<SILFunctionArgument>(storage.getArgument ());
536
- // We return false if visit a non-address here. Object args are things like
537
- // pointer_to_address that we handle earlier.
538
- if (!arg->getType ().isAddress ())
539
- return false ;
540
535
if (arg->hasConvention (SILArgumentConvention::Indirect_In_Guaranteed))
541
- return true ;
536
+ return false ;
542
537
return doesAddressHaveWriteThatInvalidatesLoadBorrow (lbi, endBorrowUses,
543
538
arg);
544
539
}
@@ -547,7 +542,7 @@ bool LoadBorrowNeverInvalidatedAnalysis::isNeverInvalidated(
547
542
//
548
543
// FIXME: The yielded address could overlap with another address in this
549
544
// function.
550
- return true ;
545
+ return false ;
551
546
}
552
547
case AccessedStorage::Box: {
553
548
return doesAddressHaveWriteThatInvalidatesLoadBorrow (lbi, endBorrowUses,
0 commit comments