@@ -945,8 +945,8 @@ struct ConcreteArgumentCopy {
945945 }
946946
947947 static Optional<ConcreteArgumentCopy>
948- generate (const ConcreteExistentialInfo &CEI , ApplySite apply, unsigned argIdx ,
949- SILBuilderContext &BuilderCtx ) {
948+ generate (const ConcreteExistentialInfo &existentialInfo , ApplySite apply,
949+ unsigned argIdx, SILBuilderContext &builderCtx ) {
950950 SILParameterInfo paramInfo =
951951 apply.getOrigCalleeConv ().getParamInfoForSILArg (argIdx);
952952 // Mutation should have been checked before we get this far.
@@ -976,21 +976,23 @@ struct ConcreteArgumentCopy {
976976 if (!paramInfo.isFormalIndirect ())
977977 return None;
978978
979- SILBuilderWithScope B (apply.getInstruction (), BuilderCtx );
979+ SILBuilderWithScope builder (apply.getInstruction (), builderCtx );
980980 auto loc = apply.getLoc ();
981- auto *ASI = B.createAllocStack (loc, CEI.ConcreteValue ->getType ());
981+ auto *asi =
982+ builder.createAllocStack (loc, existentialInfo.ConcreteValue ->getType ());
982983 // If the type is an address, simple copy it.
983- if (CEI .ConcreteValue ->getType ().isAddress ()) {
984- B .createCopyAddr (loc, CEI .ConcreteValue , ASI , IsNotTake,
985- IsInitialization_t::IsInitialization);
984+ if (existentialInfo .ConcreteValue ->getType ().isAddress ()) {
985+ builder .createCopyAddr (loc, existentialInfo .ConcreteValue , asi , IsNotTake,
986+ IsInitialization_t::IsInitialization);
986987 } else {
987988 // Otherwise, we probably got the value from the source of a store
988989 // instruction so, create a store into the temporary argument.
989- B.createStrongRetain (loc, CEI.ConcreteValue , B.getDefaultAtomicity ());
990- B.createStore (loc, CEI.ConcreteValue , ASI,
991- StoreOwnershipQualifier::Unqualified);
990+ auto copy =
991+ builder.emitCopyValueOperation (loc, existentialInfo.ConcreteValue );
992+ builder.emitStoreValueOperation (loc, copy, asi,
993+ StoreOwnershipQualifier::Init);
992994 }
993- return ConcreteArgumentCopy (origArg, ASI );
995+ return ConcreteArgumentCopy (origArg, asi );
994996 }
995997};
996998
@@ -1416,7 +1418,7 @@ static void emitMatchingRCAdjustmentsForCall(ApplyInst *Call, SILValue OnX) {
14161418
14171419 // Emit a retain for the @owned return.
14181420 SILBuilderWithScope Builder (Call);
1419- Builder.createRetainValue (Call->getLoc (), OnX, Builder. getDefaultAtomicity () );
1421+ OnX = Builder.emitCopyValueOperation (Call->getLoc (), OnX);
14201422
14211423 // Emit a release for the @owned parameter, or none for a @guaranteed
14221424 // parameter.
@@ -1428,7 +1430,7 @@ static void emitMatchingRCAdjustmentsForCall(ApplyInst *Call, SILValue OnX) {
14281430 ParamInfo == ParameterConvention::Direct_Guaranteed);
14291431
14301432 if (ParamInfo == ParameterConvention::Direct_Owned)
1431- Builder.createReleaseValue (Call->getLoc (), OnX, Builder. getDefaultAtomicity () );
1433+ Builder.emitDestroyValueOperation (Call->getLoc (), OnX);
14321434}
14331435
14341436// / Replace an application of a cast composition f_inverse(f(x)) by x.
0 commit comments