Add a tiny BorrowedAddress utility.

Determines whether an address might be inside a borrowed scope. If so,
then any address substitution needs to find that scope boundary to
avoid violating its basic guarantee that all uses are within scope.
This commit is contained in:
Andrew Trick
2021-08-05 19:53:12 -07:00
parent 1f64871b31
commit a6cb54511a
5 changed files with 73 additions and 39 deletions

View File

@@ -62,20 +62,6 @@ SILValue swift::getUnderlyingObject(SILValue v) {
}
}
SILValue
swift::getUnderlyingObjectStoppingAtObjectToAddrProjections(SILValue v) {
if (!v->getType().isAddress())
return SILValue();
while (true) {
auto v2 = lookThroughAddressToAddressProjections(v);
v2 = stripIndexingInsts(v2);
if (v2 == v)
return v2;
v = v2;
}
}
SILValue swift::getUnderlyingObjectStopAtMarkDependence(SILValue v) {
while (true) {
SILValue v2 = stripCastsWithoutMarkDependence(v);