File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
SwiftCompilerSources/Sources/Optimizer/FunctionPasses Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -647,9 +647,10 @@ private extension MovableInstructions {
647
647
return false
648
648
}
649
649
650
+ let dominatingBlocks = loop. getBlocksThatDominateAllExitingAndLatchBlocks ( context)
650
651
var changed = false
651
652
652
- for scopedInst in scopedInsts {
653
+ for scopedInst in scopedInsts where dominatingBlocks . contains ( scopedInst . parentBlock ) {
653
654
guard scopedInst. hoist ( outOf: loop, context) else {
654
655
continue
655
656
}
@@ -1106,9 +1107,9 @@ private extension ScopedInstruction {
1106
1107
case is BeginApplyInst :
1107
1108
return true // Has already been checked with other full applies.
1108
1109
case is LoadBorrowInst :
1109
- for inst in loop . loopBlocks . lazy . flatMap ( \ . instructions ) {
1110
- if ( inst is DestroyAddrInst || inst is StoreInst ) && inst . operands . contains ( where : { context . aliasAnalysis . mayAlias ( operands. first!. value, $0 . value ) } ) {
1111
- if !scope. contains ( inst ) {
1110
+ for storeInst in analyzedInstructions . stores {
1111
+ if storeInst . mayWrite ( toAddress : operands. first!. value, context . aliasAnalysis ) {
1112
+ if !scope. contains ( storeInst ) {
1112
1113
return false
1113
1114
}
1114
1115
}
You can’t perform that action at this time.
0 commit comments