3 Commits

Author SHA1 Message Date
Erik Eckstein
8aa911ba2f Optimizer: add simplifications for destroy_value
Attempt to optimize by forwarding the destroy to operands of forwarding instructions.

```
  %3 = struct $S (%1, %2)
  destroy_value %3         // the only use of %3
```
->
```
  destroy_value %1
  destroy_value %2
```

The benefit of this transformation is that the forwarding instruction can be removed.

Also, handle `destroy_value` for phi arguments.
This is a more complex case where the destroyed value comes from different predecessors via a phi argument.
The optimization moves the `destroy_value` to each predecessor block.

```
bb1:
  br bb3(%0)
bb2:
  br bb3(%1)
bb3(%3 : @owned T):
  ...                // no deinit-barriers
  destroy_value %3   // the only use of %3
```
->
```
bb1:
  destroy_value %0
  br bb3
bb2:
  destroy_value %1
  br bb3
bb3:
  ...
```
2025-12-03 15:53:55 +01:00
Erik Eckstein
3f95ce9645 Optimizer: fix spelling of the Simplifiable protocol
Rename `Simplifyable` -> `Simplifiable`

NFC
2025-02-12 09:01:11 +01:00
Erik Eckstein
e718bfe8ed Optimizer: reimplement simplifications for copy_value and destroy_value in swift
So that they can run in the OnoneSimplification pass
2023-10-27 10:47:07 +02:00