SILGen: Replace uses of TypeLowering::emitCopyInto with CopyAddrInsts.

Chris and I want to move toward canonicalizing on more abstract aggregate operations (copy_addr) instead of on the component load/store/copy|destroy_value/retain|release operations, which is easier for early passes like inout deshadowing, NRVO, and move optimization to reason about. As a first step, replace the handful of places where SILGen currently used TypeLowering::emitCopyInto with simple CopyAddrInst insertions. This affects inout initializations and emitSemanticLoadInto, neither of which should disturb early passes that relied on the old behavior.

Swift SVN r8991
This commit is contained in:
Joe Groff
2013-10-07 21:17:48 +00:00
parent fb836ccedd
commit 7fc2720826
2 changed files with 7 additions and 8 deletions

View File

@@ -973,7 +973,8 @@ void SILGenFunction::emitSemanticLoadInto(SILLocation loc,
// Easy case: the types match.
if (srcTL.getLoweredType() == destTL.getLoweredType()) {
assert(!hasDifferentTypeOfRValue(srcTL));
return srcTL.emitCopyInto(B, loc, src, dest, isTake, isInit);
B.createCopyAddr(loc, src, dest, isTake, isInit);
return;
}
auto rvalue =
@@ -994,7 +995,7 @@ void SILGenFunction::emitSemanticStore(SILLocation loc,
assert(!hasDifferentTypeOfRValue(destTL));
assert(destTL.isAddressOnly() == rvalue.getType().isAddress());
if (rvalue.getType().isAddress()) {
destTL.emitCopyInto(B, loc, rvalue, dest, IsTake, isInit);
B.createCopyAddr(loc, rvalue, dest, IsTake, isInit);
} else {
emitUnloweredStoreOfCopy(B, loc, rvalue, dest, isInit);
}