mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Markers are always eliminated before -O passes. At -Onone, markers can be enabled via command line for all -Onone passes.
44 lines
1.4 KiB
Plaintext
44 lines
1.4 KiB
Plaintext
// RUN: %target-sil-opt -enforce-exclusivity=checked -emit-sorted-sil -full-access-marker-elim %s | %FileCheck %s
|
|
|
|
sil_stage raw
|
|
|
|
import Builtin
|
|
import Swift
|
|
import SwiftShims
|
|
|
|
public struct S {
|
|
@sil_stored var i: Builtin.Int64 { get set }
|
|
init(i: Int)
|
|
}
|
|
|
|
// CHECK-LABEL: sil hidden [noinline] @initS : $@convention(thin) () -> @owned S {
|
|
// CHECK: bb0:
|
|
// CHECK: %[[BOX:.*]] = alloc_box ${ var S }, var, name "s"
|
|
// CHECK: %[[ADDRS:.*]] = project_box %[[BOX]] : ${ var S }, 0
|
|
// CHECK: %[[NUM:.*]] = integer_literal $Builtin.Int64, 1
|
|
// CHECK-NOT: begin_access
|
|
// CHECK: %[[ADDRI:.*]] = struct_element_addr %[[ADDRS]] : $*S, #S.i
|
|
// CHECK: assign %[[NUM]] to %[[ADDRI]] : $*Builtin.Int64
|
|
// CHECK-NOT: end_access
|
|
// CHECK-NOT: begin_access
|
|
// CHECK: %[[VALS:.*]] = load [trivial] %[[ADDRS]] : $*S
|
|
// CHECK-NOT: end_access
|
|
// CHECK: destroy_value %[[BOX]] : ${ var S }
|
|
// CHECK: return %[[VALS]] : $S
|
|
// CHECK-LABEL: } // end sil function 'initS'
|
|
sil hidden [noinline] @initS : $@convention(thin) () -> @owned S {
|
|
bb0:
|
|
%0 = alloc_box ${ var S }, var, name "s"
|
|
%1 = project_box %0 : ${ var S }, 0
|
|
%2 = integer_literal $Builtin.Int64, 1
|
|
%3 = begin_access [modify] [unknown] %1 : $*S
|
|
%4 = struct_element_addr %3 : $*S, #S.i
|
|
assign %2 to %4 : $*Builtin.Int64
|
|
end_access %3 : $*S
|
|
%7 = begin_access [read] [unknown] %1 : $*S
|
|
%8 = load [trivial] %7 : $*S
|
|
end_access %7 : $*S
|
|
destroy_value %0 : ${ var S }
|
|
return %8 : $S
|
|
}
|