Skip to content

Commit c5475c9

Browse files
committed
AccessEnforcementOpts test cases.
1 parent df1b9b4 commit c5475c9

File tree

2 files changed

+169
-36
lines changed

2 files changed

+169
-36
lines changed

lib/SILOptimizer/Transforms/AccessEnforcementOpts.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,7 @@ foldNonNestedAccesses(AccessConflictAnalysis::AccessMap &accessMap) {
550550
// Optimize this begin_access by setting [no_nested_conflict].
551551
beginAccess->setNoNestedConflict(true);
552552
changed = true;
553+
DEBUG(llvm::dbgs() << "Folding " << *beginAccess);
553554
}
554555
return changed;
555556
}
@@ -585,6 +586,7 @@ removeLocalNonNestedAccess(AccessConflictAnalysis::Result &&result,
585586
return result.getAccessIndex(a) < result.getAccessIndex(b);
586587
});
587588
for (BeginAccessInst *beginAccess : deadAccesses) {
589+
DEBUG(llvm::dbgs() << "Removing dead access " << *beginAccess);
588590
changed = true;
589591
removeBeginAccess(beginAccess);
590592
}
@@ -612,8 +614,12 @@ struct AccessEnforcementOpts : public SILFunctionTransform {
612614
invalidateAnalysis(SILAnalysis::InvalidationKind::Instructions);
613615

614616
// Use the updated AccessedStorageAnalysis to find any uniquely identified
615-
// local storage that has no nested conflict on any of its accesses. These
616-
// can be removed entirely.
617+
// local storage that has no nested conflict on any of its accesses within
618+
// this function. These can be removed entirely.
619+
//
620+
// Note that the storage address may be passed as an argument and there may
621+
// be nested conflicts within that call, but none of the accesses within
622+
// this function will overlap.
617623
const FunctionAccessedStorage &functionAccess = ASA->getEffects(F);
618624
if (removeLocalNonNestedAccess(std::move(result), functionAccess))
619625
invalidateAnalysis(SILAnalysis::InvalidationKind::Instructions);

0 commit comments

Comments
 (0)