blob: 1c3ba1a34b796323ec6a8c09371ce6ab32e127db [file] [log] [blame]
// 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(i8* bitcast ([[GLOBAL]]* @"$s20tsan_instrumentation1gSiv" to i8*), i8* null, i8* inttoptr ({{(i32|i64)}} 1 to i8*))
%2 = tuple ()
return %2 : $()
// CHECK: ret void
}