Files
swift-mirror/lib/SIL/Utils/MemAccessUtils.cpp
Meghana Gupta 01680de084 Fixup ownership of borrow accessor results
SILGen may produce a borrow accessor result from within a local borrow scope. Such as:

```
  %ld = load_borrow %self
  %fwd = unchecked_ownership %ld
  %ex = struct_extract %fwd, #Struct.storedProperty
  end_borrow %ld
  return %ex
```

This is illegal OSSA, since the return uses a value outside it's borrow scope.

Add a new SILGenCleanup transform, to turn this into valid OSSA:

```
  %ld = load_borrow %self
  %ex = struct_extract %ld, #Struct.storedProperty
  return_borrow %ex from_scopes %ld
```
2025-10-23 05:19:11 -07:00

98 KiB