Revert "Merge pull request #84045 from MAJKFL/new-sil-licm-pass-copy-ownership"

This reverts commit a5c6156525, reversing
changes made to 2b6ea81b9e.
This commit is contained in:
Jakub Florek
2025-09-17 15:52:48 +01:00
parent f78a3c7e0a
commit d2cd281d4c
6 changed files with 154 additions and 285 deletions

View File

@@ -89,15 +89,15 @@ public struct Cloner<Context: MutatingContext> {
}
return cloned
}
public mutating func cloneRecursively(globalInitValue: Value) -> Value {
guard let cloned = cloneRecursively(value: globalInitValue, customGetCloned: { value, cloner in
public mutating func cloneRecursivelyToGlobal(value: Value) -> Value {
guard let cloned = cloneRecursively(value: value, customGetCloned: { value, cloner in
guard let beginAccess = value as? BeginAccessInst else {
return .defaultValue
}
// Skip access instructions, which might be generated for UnsafePointer globals which point to other globals.
let clonedOperand = cloner.cloneRecursively(globalInitValue: beginAccess.address)
let clonedOperand = cloner.cloneRecursivelyToGlobal(value: beginAccess.address)
cloner.recordFoldedValue(beginAccess, mappedTo: clonedOperand)
return .customValue(clonedOperand)
}) else {