Skip to content

Commit bab0011

Browse files
committed
Fix licm handling of unreferenceable storage.
1 parent 85aeb41 commit bab0011

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/LoopInvariantCodeMotion.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -587,10 +587,13 @@ private extension AnalyzedInstructions {
587587
continue
588588
}
589589

590-
if let splitLoads = loadInst.trySplit(alongPath: accessPath.projectionPath, context) {
591-
splitCounter += splitLoads.count
592-
newLoads.append(contentsOf: splitLoads)
590+
guard let splitLoads = loadInst.trySplit(alongPath: accessPath.projectionPath, context) else {
591+
newLoads.push(loadInst)
592+
return false
593593
}
594+
595+
splitCounter += splitLoads.count
596+
newLoads.append(contentsOf: splitLoads)
594597
}
595598

596599
return true

test/SILOptimizer/high_level_licm.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-sil-opt -enable-sil-verify-all %s -high-level-licm | %FileCheck %s
1+
// RUN: %target-sil-opt -enable-sil-verify-all %s -loop-invariant-code-motion | %FileCheck %s
22

33
sil_stage canonical
44

test/SILOptimizer/licm_unreferenceablestorage.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-sil-opt -sil-print-types -enable-sil-verify-all %s -licm | %FileCheck %s
1+
// RUN: %target-sil-opt -sil-print-types -enable-sil-verify-all %s -loop-invariant-code-motion | %FileCheck %s
22

33
// REQUIRES: objc_interop
44

0 commit comments

Comments
 (0)