@@ -5404,18 +5404,14 @@ void IRGenSILFunction::visitRetainValueInst(swift::RetainValueInst *i) {
54045404void IRGenSILFunction::visitRetainValueAddrInst (swift::RetainValueAddrInst *i) {
54055405 SILValue operandValue = i->getOperand ();
54065406 assert (!operandValue->getType ().isMoveOnly ());
5407- Address addr = getLoweredAddress (operandValue);
5408- SILType addrTy = operandValue->getType ();
5409- SILType objectT = addrTy.getObjectType ();
5410- llvm::Type *llvmType = addr.getAddress ()->getType ();
5411- const TypeInfo &addrTI = getTypeInfo (addrTy);
5412- auto atomicity = i->isAtomic () ? Atomicity::Atomic : Atomicity::NonAtomic;
5413- auto *outlinedF = cast<llvm::Function>(
5414- IGM.getOrCreateRetainFunction (addrTI, objectT, llvmType, atomicity));
5415- llvm::Value *args[] = {addr.getAddress ()};
5416- llvm::CallInst *call =
5417- Builder.CreateCall (outlinedF->getFunctionType (), outlinedF, args);
5418- call->setCallingConv (IGM.DefaultCC );
5407+
5408+ auto objTy = operandValue->getType ().getObjectType ();
5409+ const TypeInfo &type = getTypeInfo (objTy);
5410+ auto stackAddr = type.allocateStack (*this , objTy, " retain.value.addr.tmp" );
5411+ Address src = getLoweredAddress (operandValue);
5412+ type.initializeWithCopy (*this , stackAddr.getAddress (), src,
5413+ operandValue->getType (), false );
5414+ type.deallocateStack (*this , stackAddr, operandValue->getType ());
54195415}
54205416
54215417void IRGenSILFunction::visitCopyValueInst (swift::CopyValueInst *i) {
@@ -5494,15 +5490,10 @@ void IRGenSILFunction::visitReleaseValueInst(swift::ReleaseValueInst *i) {
54945490void IRGenSILFunction::visitReleaseValueAddrInst (
54955491 swift::ReleaseValueAddrInst *i) {
54965492 SILValue operandValue = i->getOperand ();
5497- Address addr = getLoweredAddress (operandValue);
54985493 SILType addrTy = operandValue->getType ();
5499- SILType objectT = addrTy.getObjectType ();
5500- if (tryEmitDestroyUsingDeinit (*this , addr, addrTy)) {
5501- return ;
5502- }
55035494 const TypeInfo &addrTI = getTypeInfo (addrTy);
5504- auto atomicity = i-> isAtomic () ? Atomicity::Atomic : Atomicity::NonAtomic ;
5505- addrTI.callOutlinedRelease (*this , addr, objectT, atomicity );
5495+ Address base = getLoweredAddress (operandValue) ;
5496+ addrTI.destroy (*this , base, addrTy, false /* isOutlined */ );
55065497}
55075498
55085499void IRGenSILFunction::visitDestroyValueInst (swift::DestroyValueInst *i) {
0 commit comments