@@ -470,14 +470,17 @@ extension AddressDefUseWalker {
470
470
} else {
471
471
return unmatchedPath ( address: operand, path: path)
472
472
}
473
- case is InitExistentialAddrInst , is OpenExistentialAddrInst , is BeginAccessInst ,
474
- is IndexAddrInst , is MarkMustCheckInst :
473
+ case is InitExistentialAddrInst , is OpenExistentialAddrInst ,
474
+ is IndexAddrInst , is MarkMustCheckInst :
475
475
// FIXME: for now `index_addr` is treated as a forwarding instruction since
476
476
// SmallProjectionPath does not track indices.
477
477
// This is ok since `index_addr` is eventually preceeded by a `tail_addr`
478
478
// which has pushed a `"ct"` component on the path that matches any
479
479
// `index_addr` address.
480
480
return walkDownUses ( ofAddress: instruction as! SingleValueInstruction , path: path)
481
+ case let ba as BeginAccessInst :
482
+ // Don't treat `end_access` as leaf-use. Just ignore it.
483
+ return walkDownNonEndAccessUses ( of: ba, path: path)
481
484
case let mdi as MarkDependenceInst :
482
485
if operand. index == 0 {
483
486
return walkDownUses ( ofAddress: mdi, path: path)
@@ -497,6 +500,16 @@ extension AddressDefUseWalker {
497
500
}
498
501
return . continueWalk
499
502
}
503
+
504
+ private mutating func walkDownNonEndAccessUses( of beginAccess: BeginAccessInst , path: Path ) -> WalkResult {
505
+ for operand in beginAccess. uses where !operand. isTypeDependent {
506
+ if !( operand. instruction is EndAccessInst ) ,
507
+ walkDown ( address: operand, path: path) == . abortWalk {
508
+ return . abortWalk
509
+ }
510
+ }
511
+ return . continueWalk
512
+ }
500
513
}
501
514
502
515
/// - A `UseDefWalker` can be used to find all "generating" definitions of
0 commit comments