Fix licm handling of unreferenceable storage.

This commit is contained in:
Jakub Florek
2025-08-29 12:46:27 +01:00
parent 85aeb41bd0
commit bab00113b2
3 changed files with 8 additions and 5 deletions

View File

@@ -587,10 +587,13 @@ private extension AnalyzedInstructions {
continue
}
if let splitLoads = loadInst.trySplit(alongPath: accessPath.projectionPath, context) {
splitCounter += splitLoads.count
newLoads.append(contentsOf: splitLoads)
guard let splitLoads = loadInst.trySplit(alongPath: accessPath.projectionPath, context) else {
newLoads.push(loadInst)
return false
}
splitCounter += splitLoads.count
newLoads.append(contentsOf: splitLoads)
}
return true

View File

@@ -1,4 +1,4 @@
// RUN: %target-sil-opt -enable-sil-verify-all %s -high-level-licm | %FileCheck %s
// RUN: %target-sil-opt -enable-sil-verify-all %s -loop-invariant-code-motion | %FileCheck %s
sil_stage canonical

View File

@@ -1,4 +1,4 @@
// RUN: %target-sil-opt -sil-print-types -enable-sil-verify-all %s -licm | %FileCheck %s
// RUN: %target-sil-opt -sil-print-types -enable-sil-verify-all %s -loop-invariant-code-motion | %FileCheck %s
// REQUIRES: objc_interop