swift
7938a1ff - [AddressLowering] Handle guaranteed destructures.

Commit
3 years ago
[AddressLowering] Handle guaranteed destructures. Previously, when lowering destructure_tuple and destructure_struct instructions, either a load [trivial] or load [take] was always created for each loadable field. When the operand to the destructure instruction was @owned, this was the correct behavior; but when the operand was @guaranteed, it was not. It would result in SIL like ``` (..., %elt_addr, ...) = destructure_ %addr %value = load [take] %elt_addr destroy_addr %addr ``` where (1) %elt_addr was destroyed twice (once by the load [take] and once by the destroy_addr of the aggregate and (2) the loaded value was leaked. Here, this is fixed by creating load_borrows for this case.
Author
Committer
Parents
Loading