@@ -1573,6 +1573,19 @@ struct CopiedLoadBorrowEliminationState {
1573
1573
}
1574
1574
};
1575
1575
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
+
1576
1589
// / An early transform that we run to convert any load_borrow that are copied
1577
1590
// / directly or that have any subelement that is copied to a load [copy]. This
1578
1591
// / lets the rest of the optimization handle these as appropriate.
@@ -1583,6 +1596,10 @@ struct CopiedLoadBorrowEliminationVisitor
1583
1596
CopiedLoadBorrowEliminationVisitor (CopiedLoadBorrowEliminationState &state)
1584
1597
: state(state) {}
1585
1598
1599
+ bool visitTransitiveUseAsEndPointUse (Operand *op) {
1600
+ return shouldVisitAsEndPointUse (op);
1601
+ }
1602
+
1586
1603
bool visitUse (Operand *op) {
1587
1604
LLVM_DEBUG (llvm::dbgs () << " CopiedLBElim visiting " ;
1588
1605
llvm::dbgs () << " User: " << *op->getUser ());
@@ -1978,16 +1995,7 @@ struct GatherUsesVisitor : public TransitiveAddressWalker<GatherUsesVisitor> {
1978
1995
} // end anonymous namespace
1979
1996
1980
1997
bool 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);
1991
1999
}
1992
2000
1993
2001
// Filter out recognized uses that do not write to memory.
0 commit comments