@@ -731,8 +731,6 @@ TempRValueOptPass::tryOptimizeStoreIntoTemp(StoreInst *si) {
731731 return std::next (si->getIterator ());
732732 }
733733
734- bool isOrHasEnum = tempObj->getType ().isOrHasEnum ();
735-
736734 // Scan all uses of the temporary storage (tempObj) to verify they all refer
737735 // to the value initialized by this copy. It is sufficient to check that the
738736 // only users that modify memory are the copy_addr [initialization] and
@@ -743,15 +741,6 @@ TempRValueOptPass::tryOptimizeStoreIntoTemp(StoreInst *si) {
743741 if (user == si)
744742 continue ;
745743
746- // For lexical stored values that are enums, we require that all uses are in
747- // the same block. This is because we can have incomplete address lifetimes
748- // on none/trivial paths. and OSSALifetimeCompletion currently can complete
749- // lexical values only in the presence of dead end blocks.
750- if (isOrHasEnum && si->getSrc ()->isLexical () &&
751- user->getParent () != si->getParent () && !isa<DeallocStackInst>(user)) {
752- return std::next (si->getIterator ());
753- }
754-
755744 // Bail if there is any kind of user which is not handled in the code below.
756745 switch (user->getKind ()) {
757746 case SILInstructionKind::DestroyAddrInst:
@@ -955,7 +944,7 @@ void TempRValueOptPass::run() {
955944 // Call the utlity to complete ossa lifetime.
956945 OSSALifetimeCompletion completion (function, da->get (function));
957946 for (auto it : valuesToComplete) {
958- completion.completeOSSALifetime (it);
947+ completion.completeOSSALifetime (it, /* forceBoundaryCompletion */ true );
959948 }
960949}
961950
0 commit comments