Skip to content

Commit ec1545f

Browse files
committed
Fix the getAddressAccess API.
The API was accidentally undefined, presumably because I checked in the wrong code or there was a bad merge. The API will be used by upcoming commits. Meanwhile, getAccessedAddress was not stripping access markers, which means some analysis may have been too conservative. This fix could expose issues by making existing analyses more effective.
1 parent 829f258 commit ec1545f

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

include/swift/SIL/MemAccessUtils.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@ SingleValueInstruction *isAccessProjection(SILValue v);
7878
/// findAccessedStorage() on either \p v or the returned address.
7979
SILValue getAddressAccess(SILValue v);
8080

81-
/// Convenience for stripAccessMarkers(getAddressAccess(V)).
82-
SILValue getAccessedAddress(SILValue v);
81+
/// Convenience for stripAccessMarkers(getAddressAccess(v)).
82+
inline SILValue getAccessedAddress(SILValue v) {
83+
return stripAccessMarkers(getAddressAccess(v));
84+
}
8385

8486
/// Return true if \p accessedAddress points to a let-variable.
8587
///

lib/SIL/Utils/MemAccessUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ SingleValueInstruction *swift::isAccessProjection(SILValue v) {
4747
// TODO: When the optimizer stops stripping begin_access markers, then we should
4848
// be able to assert that the result is a BeginAccessInst and the default case
4949
// is unreachable.
50-
SILValue swift::getAccessedAddress(SILValue v) {
50+
SILValue swift::getAddressAccess(SILValue v) {
5151
while (true) {
5252
assert(v->getType().isAddress());
5353
auto *projection = isAccessProjection(v);

0 commit comments

Comments
 (0)