Commits
Joe Groff committed 60b6d128734
IRGen: Implement indirect value semantics for multi-payload unions. The address-only case for multi-payload unions is icky both because combinatorial explosion makes in-place assignment challenging and also because we need to RMW spare bits in and out of the way when copying values. Because of these problems, preserve the breakdown into loadable type operations for loadable unions. For assignment of address-only unions, do an alias check, then destroy the destination and initialize from the source. The cost of the alias check should be lost among the switch branches we need to make anyway, and this avoids the temporary copy that would otherwise be needed to do the traditional load-retain-store-release dance. For initialization and destruction of address-only unions, we RMW out the spare bits in the source before doing the operation. For 'copy' operations, we RMW them back in when the operation is completed. Maybe there's a better way to do this? Swift SVN r7836