@@ -731,8 +731,6 @@ TempRValueOptPass::tryOptimizeStoreIntoTemp(StoreInst *si) {
731
731
return std::next (si->getIterator ());
732
732
}
733
733
734
- bool isOrHasEnum = tempObj->getType ().isOrHasEnum ();
735
-
736
734
// Scan all uses of the temporary storage (tempObj) to verify they all refer
737
735
// to the value initialized by this copy. It is sufficient to check that the
738
736
// only users that modify memory are the copy_addr [initialization] and
@@ -743,15 +741,6 @@ TempRValueOptPass::tryOptimizeStoreIntoTemp(StoreInst *si) {
743
741
if (user == si)
744
742
continue ;
745
743
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
-
755
744
// Bail if there is any kind of user which is not handled in the code below.
756
745
switch (user->getKind ()) {
757
746
case SILInstructionKind::DestroyAddrInst:
@@ -955,7 +944,7 @@ void TempRValueOptPass::run() {
955
944
// Call the utlity to complete ossa lifetime.
956
945
OSSALifetimeCompletion completion (function, da->get (function));
957
946
for (auto it : valuesToComplete) {
958
- completion.completeOSSALifetime (it);
947
+ completion.completeOSSALifetime (it, /* forceBoundaryCompletion */ true );
959
948
}
960
949
}
961
950
0 commit comments