@@ -85,8 +85,7 @@ class TempRValueOptPass : public SILFunctionTransform {
8585 CopyAddrInst *copyInst, const SmallPtrSetImpl<SILInstruction *> &useInsts);
8686
8787 bool
88- checkTempObjectDestroy (AllocStackInst *tempObj, CopyAddrInst *copyInst,
89- ValueLifetimeAnalysis::Frontier &tempAddressFrontier);
88+ checkTempObjectDestroy (AllocStackInst *tempObj, CopyAddrInst *copyInst);
9089
9190 bool tryOptimizeCopyIntoTemp (CopyAddrInst *copyInst);
9291 std::pair<SILBasicBlock::iterator, bool >
@@ -357,8 +356,7 @@ SILInstruction *TempRValueOptPass::getLastUseWhileSourceIsNotModified(
357356// / releasing it. Rather than detecting unbalanced load releases, simply check
358357// / that tempObj is destroyed directly on all paths.
359358bool TempRValueOptPass::checkTempObjectDestroy (
360- AllocStackInst *tempObj, CopyAddrInst *copyInst,
361- ValueLifetimeAnalysis::Frontier &tempAddressFrontier) {
359+ AllocStackInst *tempObj, CopyAddrInst *copyInst) {
362360 // ValueLifetimeAnalysis is not normally used for address types. It does not
363361 // reason about the lifetime of the in-memory object. However the utility can
364362 // be abused here to check that the address is directly destroyed on all
@@ -377,6 +375,7 @@ bool TempRValueOptPass::checkTempObjectDestroy(
377375 }
378376 // Find the boundary of tempObj's address lifetime, starting at copyInst.
379377 ValueLifetimeAnalysis vla (copyInst, users);
378+ ValueLifetimeAnalysis::Frontier tempAddressFrontier;
380379 if (!vla.computeFrontier (tempAddressFrontier,
381380 ValueLifetimeAnalysis::DontModifyCFG)) {
382381 return false ;
@@ -483,8 +482,7 @@ bool TempRValueOptPass::tryOptimizeCopyIntoTemp(CopyAddrInst *copyInst) {
483482 aa->mayWriteToMemory (lastLoadInst, copySrc))
484483 return false ;
485484
486- ValueLifetimeAnalysis::Frontier tempAddressFrontier;
487- if (!checkTempObjectDestroy (tempObj, copyInst, tempAddressFrontier))
485+ if (!isOSSA && !checkTempObjectDestroy (tempObj, copyInst))
488486 return false ;
489487
490488 LLVM_DEBUG (llvm::dbgs () << " Success: replace temp" << *tempObj);
0 commit comments