@@ -5399,18 +5399,14 @@ void IRGenSILFunction::visitRetainValueInst(swift::RetainValueInst *i) {
5399
5399
void IRGenSILFunction::visitRetainValueAddrInst (swift::RetainValueAddrInst *i) {
5400
5400
SILValue operandValue = i->getOperand ();
5401
5401
assert (!operandValue->getType ().isMoveOnly ());
5402
- Address addr = getLoweredAddress (operandValue);
5403
- SILType addrTy = operandValue->getType ();
5404
- SILType objectT = addrTy.getObjectType ();
5405
- llvm::Type *llvmType = addr.getAddress ()->getType ();
5406
- const TypeInfo &addrTI = getTypeInfo (addrTy);
5407
- auto atomicity = i->isAtomic () ? Atomicity::Atomic : Atomicity::NonAtomic;
5408
- auto *outlinedF = cast<llvm::Function>(
5409
- IGM.getOrCreateRetainFunction (addrTI, objectT, llvmType, atomicity));
5410
- llvm::Value *args[] = {addr.getAddress ()};
5411
- llvm::CallInst *call =
5412
- Builder.CreateCall (outlinedF->getFunctionType (), outlinedF, args);
5413
- call->setCallingConv (IGM.DefaultCC );
5402
+
5403
+ auto objTy = operandValue->getType ().getObjectType ();
5404
+ const TypeInfo &type = getTypeInfo (objTy);
5405
+ auto stackAddr = type.allocateStack (*this , objTy, " retain.value.addr.tmp" );
5406
+ Address src = getLoweredAddress (operandValue);
5407
+ type.initializeWithCopy (*this , stackAddr.getAddress (), src,
5408
+ operandValue->getType (), false );
5409
+ type.deallocateStack (*this , stackAddr, operandValue->getType ());
5414
5410
}
5415
5411
5416
5412
void IRGenSILFunction::visitCopyValueInst (swift::CopyValueInst *i) {
@@ -5489,15 +5485,10 @@ void IRGenSILFunction::visitReleaseValueInst(swift::ReleaseValueInst *i) {
5489
5485
void IRGenSILFunction::visitReleaseValueAddrInst (
5490
5486
swift::ReleaseValueAddrInst *i) {
5491
5487
SILValue operandValue = i->getOperand ();
5492
- Address addr = getLoweredAddress (operandValue);
5493
5488
SILType addrTy = operandValue->getType ();
5494
- SILType objectT = addrTy.getObjectType ();
5495
- if (tryEmitDestroyUsingDeinit (*this , addr, addrTy)) {
5496
- return ;
5497
- }
5498
5489
const TypeInfo &addrTI = getTypeInfo (addrTy);
5499
- auto atomicity = i-> isAtomic () ? Atomicity::Atomic : Atomicity::NonAtomic ;
5500
- addrTI.callOutlinedRelease (*this , addr, objectT, atomicity );
5490
+ Address base = getLoweredAddress (operandValue) ;
5491
+ addrTI.destroy (*this , base, addrTy, false /* isOutlined */ );
5501
5492
}
5502
5493
5503
5494
void IRGenSILFunction::visitDestroyValueInst (swift::DestroyValueInst *i) {
0 commit comments