Skip to content

Commit e3198ed

Browse files
committed
Fix AccessUtils.swift to use the project_box reference root.
1 parent 7574c1f commit e3198ed

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

SwiftCompilerSources/Sources/SIL/Utilities/AccessUtils.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,15 @@ public enum AccessBase : CustomStringConvertible, Hashable {
158158
}
159159
}
160160

161-
/// True, if the address is immediately produced by an allocation in its function.
161+
/// True, if the address is produced by an allocation in its function.
162162
public var isLocal: Bool {
163163
switch self {
164-
case .box(let pbi): return pbi.box is AllocBoxInst
165-
case .class(let rea): return rea.instance is AllocRefInstBase
166-
case .tail(let rta): return rta.instance is AllocRefInstBase
167-
case .stack: return true
168-
case .global, .argument, .yield, .pointer, .unidentified:
169-
return false
164+
case .box(let pbi): return pbi.box.referenceRoot is AllocBoxInst
165+
case .class(let rea): return rea.instance.referenceRoot is AllocRefInstBase
166+
case .tail(let rta): return rta.instance.referenceRoot is AllocRefInstBase
167+
case .stack: return true
168+
case .global, .argument, .yield, .pointer, .unidentified:
169+
return false
170170
}
171171
}
172172

@@ -241,7 +241,7 @@ public enum AccessBase : CustomStringConvertible, Hashable {
241241
// First handle all pairs of the same kind (except `yield` and `pointer`).
242242
case (.box(let pb), .box(let otherPb)):
243243
return pb.fieldIndex != otherPb.fieldIndex ||
244-
isDifferentAllocation(pb.box, otherPb.box)
244+
isDifferentAllocation(pb.box.referenceRoot, otherPb.box.referenceRoot)
245245
case (.stack(let asi), .stack(let otherAsi)):
246246
return asi != otherAsi
247247
case (.global(let global), .global(let otherGlobal)):
@@ -542,7 +542,7 @@ extension Value {
542542
return .base(walker.result.base)
543543
}
544544

545-
/// The root definition of a reference, obtained by skipping casts, etc.
545+
/// The root definition of a reference, obtained by skipping ownership forwarding and ownership transition.
546546
public var referenceRoot: Value {
547547
var value: Value = self
548548
while true {

0 commit comments

Comments
 (0)