Skip to content

Commit e3d381b

Browse files
authored
Merge pull request #83397 from Azoy/atomic-addressofrawlayout
[stdlib] Change the builtin used to get the address for Atomic
2 parents b0c1160 + c1c7c75 commit e3d381b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

stdlib/public/Synchronization/Atomics/Atomic.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public struct Atomic<Value: AtomicRepresentable>: ~Copyable {
2929
@_alwaysEmitIntoClient
3030
@_transparent
3131
var _rawAddress: Builtin.RawPointer {
32-
Builtin.unprotectedAddressOfBorrow(self)
32+
Builtin.addressOfRawLayout(self)
3333
}
3434

3535
/// Initializes a value of this atomic with the given initial value.

test/SILOptimizer/stdlib/Atomics.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func testInt(_: Int)
1313

1414
// CHECK-LABEL: sil {{.*}} @localLoad {{.*}} {
1515
// CHECK: [[ATOMIC:%.*]] = alloc_stack [lexical] [var_decl] $Atomic<Int>
16-
// CHECK: [[ATOMIC_PTR:%.*]] = address_to_pointer [[ATOMIC]]
16+
// CHECK: [[ATOMIC_PTR:%.*]] = builtin "addressOfRawLayout"<Atomic<Int>>([[ATOMIC]] : $*Atomic<Int>)
1717
// CHECK: builtin "atomicload_monotonic_Int[[PTR_SIZE]]"([[ATOMIC_PTR]] : $Builtin.RawPointer)
1818
// CHECK: dealloc_stack [[ATOMIC]] : $*Atomic<Int>
1919
// CHECK-LABEL: } // end sil function 'localLoad'
@@ -25,7 +25,7 @@ func localLoad() -> Int {
2525

2626
// CHECK-LABEL: sil {{.*}} @localStore {{.*}} {
2727
// CHECK: [[ATOMIC:%.*]] = alloc_stack [lexical] [var_decl] $Atomic<Int>
28-
// CHECK: [[ATOMIC_PTR:%.*]] = address_to_pointer [[ATOMIC]]
28+
// CHECK: [[ATOMIC_PTR:%.*]] = builtin "addressOfRawLayout"<Atomic<Int>>([[ATOMIC]] : $*Atomic<Int>)
2929
// CHECK: builtin "atomicstore_release_Int[[PTR_SIZE]]"([[ATOMIC_PTR]] : $Builtin.RawPointer
3030
// CHECK: dealloc_stack [[ATOMIC]] : $*Atomic<Int>
3131
// CHECK-LABEL: } // end sil function 'localStore'
@@ -37,7 +37,7 @@ func localStore() {
3737

3838
// CHECK-LABEL: sil {{.*}} @localExchange {{.*}} {
3939
// CHECK: [[ATOMIC:%.*]] = alloc_stack [lexical] [var_decl] $Atomic<Int>
40-
// CHECK: [[ATOMIC_PTR:%.*]] = address_to_pointer [[ATOMIC]]
40+
// CHECK: [[ATOMIC_PTR:%.*]] = builtin "addressOfRawLayout"<Atomic<Int>>([[ATOMIC]] : $*Atomic<Int>)
4141
// CHECK: builtin "atomicrmw_xchg_acquire_Int[[PTR_SIZE]]"([[ATOMIC_PTR]] : $Builtin.RawPointer
4242
// CHECK: dealloc_stack [[ATOMIC]] : $*Atomic<Int>
4343
// CHECK-LABEL: } // end sil function 'localExchange'
@@ -49,7 +49,7 @@ func localExchange() -> Int {
4949

5050
// CHECK-LABEL: sil {{.*}} @localCompareExchange {{.*}} {
5151
// CHECK: [[ATOMIC:%.*]] = alloc_stack [lexical] [var_decl] $Atomic<Int>
52-
// CHECK: [[ATOMIC_PTR:%.*]] = address_to_pointer [[ATOMIC]]
52+
// CHECK: [[ATOMIC_PTR:%.*]] = builtin "addressOfRawLayout"<Atomic<Int>>([[ATOMIC]] : $*Atomic<Int>)
5353
// CHECK: builtin "cmpxchg_seqcst_seqcst_Int[[PTR_SIZE]]"([[ATOMIC_PTR]] : $Builtin.RawPointer
5454
// CHECK: dealloc_stack [[ATOMIC]] : $*Atomic<Int>
5555
// CHECK-LABEL: } // end sil function 'localCompareExchange'

0 commit comments

Comments
 (0)