mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[semantic-arc] Handle the rest of the unqualified mem opts in SILGen.
Keep in mind that these are approximations that will not impact correctness since in all cases I ensured that the SIL will be the same after the OwnershipModelEliminator has run. The cases that I was unsure of I commented with SEMANTIC ARC TODO. Once we have the verifier any confusion that may have occurred here will be dealt with. rdar://28685236
This commit is contained in:
@@ -317,8 +317,9 @@ public:
|
||||
// load+materialize in some cases, but it's not really important.
|
||||
SILValue selfValue = self.getValue();
|
||||
if (selfValue->getType().isAddress()) {
|
||||
selfValue =
|
||||
gen.B.createLoad(loc, selfValue, LoadOwnershipQualifier::Unqualified);
|
||||
// SEMANTIC ARC TODO: We are returning self as a borrowed value. Is this
|
||||
// correct?
|
||||
selfValue = gen.B.createLoadBorrow(loc, selfValue);
|
||||
}
|
||||
|
||||
// Do a derived-to-base conversion if necessary.
|
||||
@@ -651,8 +652,8 @@ MaterializeForSetEmitter::createAddressorCallback(SILFunction &F,
|
||||
SILValue self) {
|
||||
auto ownerAddress =
|
||||
gen.B.createProjectValueBuffer(loc, ownerType, callbackStorage);
|
||||
auto owner = gen.B.createLoad(loc, ownerAddress,
|
||||
LoadOwnershipQualifier::Unqualified);
|
||||
auto owner = gen.B.emitLoadValueOperation(loc, ownerAddress,
|
||||
LoadOwnershipQualifier::Take);
|
||||
|
||||
switch (addressorKind) {
|
||||
case AddressorKind::NotAddressor:
|
||||
@@ -764,8 +765,8 @@ MaterializeForSetEmitter::createSetterCallback(SILFunction &F,
|
||||
SILValue indicesV =
|
||||
gen.B.createProjectValueBuffer(loc, indicesTy, callbackBuffer);
|
||||
if (indicesTL->isLoadable())
|
||||
indicesV = gen.B.createLoad(loc, indicesV,
|
||||
LoadOwnershipQualifier::Unqualified);
|
||||
indicesV = indicesTL->emitLoad(gen.B, loc, indicesV,
|
||||
LoadOwnershipQualifier::Take);
|
||||
ManagedValue mIndices =
|
||||
gen.emitManagedRValueWithCleanup(indicesV, *indicesTL);
|
||||
|
||||
@@ -785,7 +786,7 @@ MaterializeForSetEmitter::createSetterCallback(SILFunction &F,
|
||||
value = gen.B.createPointerToAddress(
|
||||
loc, value, valueTL.getLoweredType().getAddressType(), /*isStrict*/ true);
|
||||
if (valueTL.isLoadable())
|
||||
value = gen.B.createLoad(loc, value, LoadOwnershipQualifier::Unqualified);
|
||||
value = valueTL.emitLoad(gen.B, loc, value, LoadOwnershipQualifier::Take);
|
||||
ManagedValue mValue = gen.emitManagedRValueWithCleanup(value, valueTL);
|
||||
RValue rvalue(gen, loc, lvalue.getSubstFormalType(), mValue);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user