@@ -1573,6 +1573,19 @@ struct CopiedLoadBorrowEliminationState {
15731573 }
15741574};
15751575
1576+ static bool shouldVisitAsEndPointUse (Operand *op) {
1577+ // If an access is static and marked as "no nested conflict", we use that
1578+ // in switch codegen to mark an opaque sub-access that move-only checking
1579+ // should not look through.
1580+ if (auto ba = dyn_cast<BeginAccessInst>(op->getUser ())) {
1581+ if (ba->getEnforcement () == SILAccessEnforcement::Static
1582+ && ba->hasNoNestedConflict ()) {
1583+ return true ;
1584+ }
1585+ }
1586+ return false ;
1587+ }
1588+
15761589// / An early transform that we run to convert any load_borrow that are copied
15771590// / directly or that have any subelement that is copied to a load [copy]. This
15781591// / lets the rest of the optimization handle these as appropriate.
@@ -1583,6 +1596,10 @@ struct CopiedLoadBorrowEliminationVisitor
15831596 CopiedLoadBorrowEliminationVisitor (CopiedLoadBorrowEliminationState &state)
15841597 : state(state) {}
15851598
1599+ bool visitTransitiveUseAsEndPointUse (Operand *op) {
1600+ return shouldVisitAsEndPointUse (op);
1601+ }
1602+
15861603 bool visitUse (Operand *op) {
15871604 LLVM_DEBUG (llvm::dbgs () << " CopiedLBElim visiting " ;
15881605 llvm::dbgs () << " User: " << *op->getUser ());
@@ -1978,16 +1995,7 @@ struct GatherUsesVisitor : public TransitiveAddressWalker<GatherUsesVisitor> {
19781995} // end anonymous namespace
19791996
19801997bool GatherUsesVisitor::visitTransitiveUseAsEndPointUse (Operand *op) {
1981- // If an access is static and marked as "no nested conflict", we use that
1982- // in switch codegen to mark an opaque sub-access that move-only checking
1983- // should not look through.
1984- if (auto ba = dyn_cast<BeginAccessInst>(op->getUser ())) {
1985- if (ba->getEnforcement () == SILAccessEnforcement::Static
1986- && ba->hasNoNestedConflict ()) {
1987- return true ;
1988- }
1989- }
1990- return false ;
1998+ return shouldVisitAsEndPointUse (op);
19911999}
19922000
19932001// Filter out recognized uses that do not write to memory.
0 commit comments