File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
SwiftCompilerSources/Sources/Optimizer/FunctionPasses Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -744,10 +744,9 @@ extension ScopeExtension {
744744
745745 // Append each scope that needs extention to scopesToExtend from the inner to the outer scope.
746746 for extScope in scopes. reversed ( ) {
747- // An outer scope might not originally cover one of its inner scopes. Therefore, extend 'extendedUseRange' to to
748- // cover this scope's end instructions. The extended scope must at least cover the original scopes because the
749- // original scopes may protect other operations.
750747 var mustExtend = false
748+ // Iterating over scopeEndInst ignores unreachable paths which may not include the dealloc_stack. This is fine
749+ // because the stack allocation effectively covers the entire unreachable path.
751750 for scopeEndInst in extScope. endInstructions {
752751 switch extendedUseRange. overlaps ( pathBegin: extScope. firstInstruction, pathEnd: scopeEndInst, context) {
753752 case . containsPath, . containsEnd, . disjoint:
@@ -757,6 +756,10 @@ extension ScopeExtension {
757756 break
758757 case . containsBegin, . overlappedByPath:
759758 // containsBegin can occur when the extendable scope has the same begin as the use range.
759+ //
760+ // An outer scope might not originally cover one of its inner scopes. Therefore, extend 'extendedUseRange' to
761+ // to cover this scope's end instructions. The extended scope must at least cover the original scopes because
762+ // the original scopes may protect other operations.
760763 extendedUseRange. insert ( scopeEndInst)
761764 break
762765 }
You can’t perform that action at this time.
0 commit comments