@@ -85,8 +85,7 @@ class TempRValueOptPass : public SILFunctionTransform {
85
85
CopyAddrInst *copyInst, const SmallPtrSetImpl<SILInstruction *> &useInsts);
86
86
87
87
bool
88
- checkTempObjectDestroy (AllocStackInst *tempObj, CopyAddrInst *copyInst,
89
- ValueLifetimeAnalysis::Frontier &tempAddressFrontier);
88
+ checkTempObjectDestroy (AllocStackInst *tempObj, CopyAddrInst *copyInst);
90
89
91
90
bool tryOptimizeCopyIntoTemp (CopyAddrInst *copyInst);
92
91
std::pair<SILBasicBlock::iterator, bool >
@@ -357,8 +356,7 @@ SILInstruction *TempRValueOptPass::getLastUseWhileSourceIsNotModified(
357
356
// / releasing it. Rather than detecting unbalanced load releases, simply check
358
357
// / that tempObj is destroyed directly on all paths.
359
358
bool TempRValueOptPass::checkTempObjectDestroy (
360
- AllocStackInst *tempObj, CopyAddrInst *copyInst,
361
- ValueLifetimeAnalysis::Frontier &tempAddressFrontier) {
359
+ AllocStackInst *tempObj, CopyAddrInst *copyInst) {
362
360
// ValueLifetimeAnalysis is not normally used for address types. It does not
363
361
// reason about the lifetime of the in-memory object. However the utility can
364
362
// be abused here to check that the address is directly destroyed on all
@@ -377,6 +375,7 @@ bool TempRValueOptPass::checkTempObjectDestroy(
377
375
}
378
376
// Find the boundary of tempObj's address lifetime, starting at copyInst.
379
377
ValueLifetimeAnalysis vla (copyInst, users);
378
+ ValueLifetimeAnalysis::Frontier tempAddressFrontier;
380
379
if (!vla.computeFrontier (tempAddressFrontier,
381
380
ValueLifetimeAnalysis::DontModifyCFG)) {
382
381
return false ;
@@ -483,8 +482,7 @@ bool TempRValueOptPass::tryOptimizeCopyIntoTemp(CopyAddrInst *copyInst) {
483
482
aa->mayWriteToMemory (lastLoadInst, copySrc))
484
483
return false ;
485
484
486
- ValueLifetimeAnalysis::Frontier tempAddressFrontier;
487
- if (!checkTempObjectDestroy (tempObj, copyInst, tempAddressFrontier))
485
+ if (!isOSSA && !checkTempObjectDestroy (tempObj, copyInst))
488
486
return false ;
489
487
490
488
LLVM_DEBUG (llvm::dbgs () << " Success: replace temp" << *tempObj);
0 commit comments