swift
211299d4 - [Mem2Reg] Don't promote proj(unchecked_addr_cast).

Commit
124 days ago
[Mem2Reg] Don't promote proj(unchecked_addr_cast). In OSSA, the result of an `unchecked_bitwise_cast` must immediately be copied or `unchecked_bitwise_cast`'d again. In particular, it is not permitted to borrow it. For example, the result can't be borrowed for the purpose of performinig additional projections (`struct_extract`, `tuple_extract`) on the borrowed value. Consequently, we cannot promote an address if such a promotion would result in such a pattern. That means we can't promote an address `%addr` which is used like `struct_element_addr(unchecked_addr_cast(%addr))` or `tuple_element_addr(unchecked_addr_cast(%addr))`. We can still promote `unchecked_addr_cast(unchecked_addr_cast(%addr))`. In ownership-lowered SIL, this doesn't apply and we can still promote address with such projections. rdar://153693915
Author
Committer
Parents
Loading