@@ -1449,7 +1449,7 @@ namespace {
1449
1449
// load %elt1 // non-use (unseen)
1450
1450
// %elt2 = struct_element_addr %base, #2 // outer projection (followed)
1451
1451
// load %elt2 // exact use
1452
- // %sub = struct_element_addr %elt2, # i // inner projection (followed)
1452
+ // %sub = struct_element_addr %elt2, % i // inner projection (followed)
1453
1453
// load %sub // inner use
1454
1454
//
1455
1455
// A use may be a BranchInst if the corresponding phi does not have common
@@ -1467,8 +1467,12 @@ class AccessPathDefUseTraversal {
1467
1467
// The origin of the def-use traversal.
1468
1468
AccessStorage storage;
1469
1469
1470
- // Remaining access path indices from the most recently visited def to any
1471
- // exact use in def-use order.
1470
+ // Indices of the path to match from inner to outer component.
1471
+ // A cursor is used to represent the most recently visited def.
1472
+ // During def-use traversal, the cursor starts at the end of pathIndicies and
1473
+ // decrements with each projection.
1474
+ // The first index represents an exact match.
1475
+ // Index < 0 represents some subobject of the requested path.
1472
1476
SmallVector<AccessPath::Index, 4 > pathIndices;
1473
1477
1474
1478
// A point in the def-use traversal. isRef() is true only for object access
@@ -1884,8 +1888,8 @@ bool swift::visitAccessPathUses(AccessUseVisitor &visitor,
1884
1888
}
1885
1889
1886
1890
bool swift::visitAccessStorageUses (AccessUseVisitor &visitor,
1887
- AccessStorage storage,
1888
- SILFunction *function) {
1891
+ AccessStorage storage,
1892
+ SILFunction *function) {
1889
1893
IndexTrieNode *emptyPath = function->getModule ().getIndexTrieRoot ();
1890
1894
return visitAccessPathUses (visitor, AccessPath (storage, emptyPath, 0 ),
1891
1895
function);
0 commit comments