mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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: ... ```
5.4 KiB
5.4 KiB