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 {
744
744
745
745
// Append each scope that needs extension to scopesToExtend from the inner to the outer scope.
746
746
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.
750
747
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.
751
750
for scopeEndInst in extScope. endInstructions {
752
751
switch extendedUseRange. overlaps ( pathBegin: extScope. firstInstruction, pathEnd: scopeEndInst, context) {
753
752
case . containsPath, . containsEnd, . disjoint:
@@ -757,6 +756,10 @@ extension ScopeExtension {
757
756
break
758
757
case . containsBegin, . overlappedByPath:
759
758
// 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.
760
763
extendedUseRange. insert ( scopeEndInst)
761
764
break
762
765
}
You can’t perform that action at this time.
0 commit comments