Skip to content

Commit febdf30

Browse files
committed
[SSADestroyHoisting] Tie barriers to lifetimes.
Only respect deinit barriers when lexical lifetimes are enabled. If they aren't, hoist destroy_addrs of all addresses aggressively regardless of whether doing so involves hoisting over deinit barriers.
1 parent fcde683 commit febdf30

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/SILOptimizer/Transforms/SSADestroyHoisting.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,12 @@ bool hoistDestroys(SILValue root, bool ignoreDeinitBarriers,
729729
// The algorithm assumes no critical edges.
730730
assert(function->hasOwnership() && "requires OSSA");
731731

732+
// If lexical lifetimes aren't enabled, then deinit barriers aren't respected.
733+
auto &module = function->getModule();
734+
auto enableLexicalLifetimes =
735+
module.getASTContext().SILOpts.supportsLexicalLifetimes(module);
736+
ignoreDeinitBarriers = ignoreDeinitBarriers || !enableLexicalLifetimes;
737+
732738
return HoistDestroys(root, ignoreDeinitBarriers, remainingDestroyAddrs,
733739
deleter)
734740
.perform();

0 commit comments

Comments
 (0)