@@ -5404,18 +5404,14 @@ void IRGenSILFunction::visitRetainValueInst(swift::RetainValueInst *i) {
5404
5404
void IRGenSILFunction::visitRetainValueAddrInst (swift::RetainValueAddrInst *i) {
5405
5405
SILValue operandValue = i->getOperand ();
5406
5406
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 ());
5419
5415
}
5420
5416
5421
5417
void IRGenSILFunction::visitCopyValueInst (swift::CopyValueInst *i) {
@@ -5494,15 +5490,10 @@ void IRGenSILFunction::visitReleaseValueInst(swift::ReleaseValueInst *i) {
5494
5490
void IRGenSILFunction::visitReleaseValueAddrInst (
5495
5491
swift::ReleaseValueAddrInst *i) {
5496
5492
SILValue operandValue = i->getOperand ();
5497
- Address addr = getLoweredAddress (operandValue);
5498
5493
SILType addrTy = operandValue->getType ();
5499
- SILType objectT = addrTy.getObjectType ();
5500
- if (tryEmitDestroyUsingDeinit (*this , addr, addrTy)) {
5501
- return ;
5502
- }
5503
5494
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 */ );
5506
5497
}
5507
5498
5508
5499
void IRGenSILFunction::visitDestroyValueInst (swift::DestroyValueInst *i) {
0 commit comments