mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
32 lines
1.0 KiB
Plaintext
32 lines
1.0 KiB
Plaintext
// RUN: %target-swift-frontend %s -emit-ir | %FileCheck %s
|
|
|
|
sil_stage canonical
|
|
|
|
import Builtin
|
|
import Swift
|
|
|
|
var g: Int
|
|
|
|
public func inoutAccess()
|
|
|
|
sil_global hidden @$s20tsan_instrumentation1gSiv : $Int
|
|
|
|
// CHECK: @"$s20tsan_instrumentation1gSiv" = hidden global [[GLOBAL:%.*]] zeroinitializer, align {{.*}}
|
|
|
|
// The inout access builtin is currently turned into a call to the __tsan_write1
|
|
// compiler-rt instrumentation. Eventually we will add a specific
|
|
// instrumentation callback for tsan inout accesses to compiler-rt.
|
|
|
|
// CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @"$s20tsan_instrumentation11inoutAccessyyF"()
|
|
// foo() -> ()
|
|
sil @$s20tsan_instrumentation11inoutAccessyyF : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = global_addr @$s20tsan_instrumentation1gSiv : $*Int
|
|
%1 = builtin "tsanInoutAccess"(%0 : $*Int) : $()
|
|
// CHECK: call void @__tsan_external_write(ptr @"$s20tsan_instrumentation1gSiv", ptr null, ptr inttoptr ({{(i32|i64)}} 1 to ptr))
|
|
|
|
%2 = tuple ()
|
|
return %2 : $()
|
|
// CHECK: ret void
|
|
}
|