swift
8db4bb52 - Fix SILCombine to use OSSA RAUW prepareReplacement

Commit
4 years ago
Fix SILCombine to use OSSA RAUW prepareReplacement These SILCombine patterns produce new instructions that use the the original value after it is updated for OSSA. The RAUW utility needs to copy/borrow the original value before SILCombine can generate the new replacement. Then SILCombine can pass that replacement back to RAUW to perform the final replaceAllUsesWith. 1. PointerToAddress and RawPointerToRef Fixes bugs where RAUW inserts borrows in the wrong place. 2. UncheckedBitwiseCast The OSSA RAUW helper is incorrect here for producing a new UncheckedRefCast. Simply don't use it. Since a bitwise cast is an "Unowned" pointer escape, simply convert the unchecked_bitwise_cast opcode to unchecked_ref_cast with Unowned forwarding ownership. 3. ConvertFunction Make sure RAUW is never called with a replacement value that has different ownership than the original.
Author
Committer
Parents
Loading