mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user