Erik Eckstein
|
9631d6cdf8
|
SimplifyLoad/SimplifyLoadBorrow: add two peephole optimizations
* Replace address casts of heap objects
```
%1 = unchecked_addr_cast %0 : $*SomeClass to $*OtherClass
%2 = load [copy] %1
```
with ref-casts of the loaded value
```
%1 = load [copy] %0
%2 = unchecked_ref_cast %1 : $SomeClass to $OtherClass
```
* Replace a `load_borrow` of a `store_borrow` with a `begin_borrow`:
```
%1 = alloc_stack $T
%2 = store_borrow %0 to %1
...
%3 = load_borrow %2
// ... uses of %3
end_borrow %3
```
->
```
%1 = alloc_stack $T
%2 = store_borrow %0 to %1
...
%3 = begin_borrow %0
// ... uses of %3
end_borrow %3
```
|
2025-12-19 17:43:59 +01:00 |
|